On Sun, Oct 6, 2013 at 2:07 PM, Terry Brown <[email protected]> wrote:

To make euro signs with ctrl-alt-e I had to set the keyboard layout to
> DE (German), I assume you've done something similar, and comment out
> (add #):
>
> # set-find-anywhere    = Alt-Ctrl-e
>
> in leoSettings.leo#@settings-->Keyboard shortcuts-->@keys EKR
> bindings-->@shortcuts Find commands
>
> But rather than commenting it out in the system's settings file, it
> would be better to unset it in the myLeoSettings.leo
>
> Edward - is there a way to do that, to remove a shortcut assigned in
> leoSettings.leo from myLeoSettings.leo?
>

Haha.  Two big sighs in one evening.  There is a *lot* of code involved in
this question.

The answer to your question is kinda yes and no.  You can't completely
remove a shortcut, but you can assign it to another command.

I think that doing the following is *supposed* to work:

    self-insert-command = Alt-Ctrl-E

but it doesn't for two reasons:

1. (Easy)  At present, there is no official name for the
self-insert-command command.  The command name is commented out in the
command-name table with the explanation:

    # Exists, but can not be executed via the minibuffer.

It's easy enough to re-enable the command, and I will do so. But alas...

2. (Probably not too hard) The selfInsertCommand method doesn't work for
Alt-Ctrl characters.

The event argument to selfInsertCommand is a leoKeyEvent, *not* a Qt event.
At present the leoKeyEvent does not contain the actual QKeyEvent. But it
*should* be possible to insert the proper character into the body pane
given the original key event ;-)

Two tricky settings come into play:

    @bool enable_alt_ctrl_bindings = True
    @bool ignore_unbound_non_ascii_keys

Hah.  I don't think the second setting even exists in leoSettings.leo.  But
the default value for a non-existent setting, False, is good enough.

The first setting is set to True by default.  But if it is False *all*
Alt-Ctrl keys will be passed (via a *long* path) to selfInsertChar.  Given
the original QKeyEvent, selfInsertChar will be able to insert the proper
key in the body pane ;-)

Conclusions

These problems should be fixed for 4.11b1 as follows:

A. Pass the original QKeyEvent in every leoKeyEvent.

B. self-insert-command must be a real command, even though it will never do
anything if executed from the minibuffer.

This will allow Victor to create bindings like::

    self-insert-char = Alt-Ctrl-E

and similarly for all the Alt Gr keys he uses.  This should be simpler than
setting @bool enable_alt_ctrl_bindings = False, which would disable useful
key bindings.

Edward

P.S. I have spent several hours on this reply.  The first draft discussed
the bowels of Leo's key-handling code. The less said about that the better!

EKR

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to