texmacs-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Texmacs-dev] [TeXmacs] minibuffer support in Qt version


From: Miguel de Benito Delgado
Subject: Re: [Texmacs-dev] [TeXmacs] minibuffer support in Qt version
Date: Sun, 27 Apr 2014 09:41:54 +0200

Hi Kostas,

  sorry for the late reply. I've shitloads of things to do and I've shunted all TeXmacs stuff to the "don't even think about it" folder.

Anyway, here are my 2c. I'm sending to the list as well, as this might be of interest to someone.

On 23 April 2014 14:35, Kostas Oikonomou <address@hidden> wrote:
Thanks.   I am now looking at QTMMenuHelper.cpp, where it says

QTMLineEdit::keyPressEvent (QKeyEvent* ev)

Is this the right place?  If so, please explain a little more how to proceed with your suggestion

Yes, that is the standard key event handler in a Qt Widget. The code there is intended to handle tab completion in an "intuitive" manner (and fails miserably at it). What you need to do is to add new cases (and if you have the time, please fix the mess already there). Basically you have to:

1. Call kbd-find-rev-binding to find which keys are currently bound to the actions you want to handle. E.g.

    string s = as_string (call ("kbd-find-rev-binding",  "(kbd-end-line)"));    // string representation of key to move to EOL

2. Decode these key definitions, which will be in a format like "C-x C-v", "M-right", etc. into something you can handle in your C++ code (e.g. Qt:Key_Right, etc.). You'll have to follow some of what is done at the beginning of QTMWidget::keyPressEvent(), but you might also have to handle the wildcards present in key definitions, e.g. things like "std c". There's some c++ code to this effect in tm_config.cpp, I think.

3. Add new cases to QTMLineEdit::keyPressEvent() where you handle the keys you must. The tricky part will be handling key sequences as well. I don't know precisely how this is done, but basically all keypresses are in the end sent to edit_interface_rep::key_press(), where it seems like try_shortcut() is the main player. You'll have to start by understanding how this works. :(

> I think it’d be best if the QTMLineWidget used the current shortcuts (that it can understand) to ensure consistency. This > can be done calling (for instance in the widget's constructor) the scheme function kbd-find-rev-binding.

Where is the widget's constructor?  Can you send an example line of code calling kbd-find-rev-binding()?

With widget constructor I mean C++ object constructor, so QTMLineEdit::QTMLineEdit. If it isn't already there, just add one.
 
Thanks.
 
Good luck!
--
Miguel de  Benito.



                            Kostas




On 04/23/2014 01:27, Miguel de Benito Delgado wrote:

Ooops! That would be QTMLineEdit, of course! Sorry.

Best,
--
Miguel.

Am 23.04.2014 02:19 schrieb "Kostas Oikonomou" <address@hidden>:
Hi Miguel,

I'm finally getting around to this...   I just checked out the SVN version, and to start with I tried to find a mention
of QTMLineWidget:

address@hidden ~/build/texmacs-svn/src]$ find ./ -exec grep -l QTMLineWidget {} \;
address@hidden ~/build/texmacs-svn/src]$

But I didn't find anything.

                                                     Kostas

On 01/12/2014 03:58, Miguel de Benito Delgado wrote:
Hi Kostas,

  sorry for the delay and glad to see you’re willing to help out. :)

The problem is that the QTMLineWidget, which implements the line inputs uses Qt standard shortcuts. Basically Joris says that in order to solve this it’s best to ignore TeXmacs' keyboard shortcut system and hardcode a few standard shortcuts for the line inputs in each “look and feel”.

I think this is not such a great idea so he suggests we provide some method for the user to change the shortcuts for those line inputs only. Probably through standard preferences in preferences.scm. 

I think it’d be best if the QTMLineWidget used the current shortcuts (that it can understand) to ensure consistency. This can be done calling (for instance in the widget's constructor) the scheme function kbd-find-rev-binding. To test it, in a scheme session type:

(kbd-find-rev-binding "(kbd-end-line)")

Notice that we use the string representation of the command, as given in the kbd-map. You can see all relevant shortcuts in progs/generic/generic-kbd.scm.

In Qt we need to reimplement the KeyEvent handler in QTMLineWidget and filter those key presses configured for left, right, end, start, etc.

If you finally find time to work on this don't hesitate to ask for help.

Best,
--
Miguel de  Benito.


On Mon, Jan 6, 2014 at 11:58 PM, Kostas Oikonomou <address@hidden> wrote:
Hi Miguel,

Glad to see you're the responsible party :-)

I read the link you sent, and I am willing to help.  (Though my abilities in C++ are limited.) 
As a first step, however, I am not sure exactly what is the solution you and Joris have agreed upon.
Could you please summarize?

I am not cc'ing the list, should I?

                                Kostas


On 01/06/2014 13:04, Miguel de Benito Delgado wrote:
Hi Kostas,

  this would be:


and yes, it is assigned to yours truly... Patches are welcome! ;-D

--
Miguel de  Benito.


On Mon, Jan 6, 2014 at 4:46 PM, Kostas Oikonomou <address@hidden> wrote:
Hi,

Given that the X version of TeXmacs seems to be on its way out, can someone comment on what it would take to make the minibuffer in the Qt version behave like the minibuffer of the X version?  In particular, to have C-g work, and to have the ability to move around in the minibuffer line, and to edit it?

In my view, minibuffer support is the only significant feature missing from the Qt version for it to be a compete replacement of the X version.

                            Kostas







reply via email to

[Prev in Thread] Current Thread [Next in Thread]