On May 25, 9:12 am, "Edward K. Ream" <[email protected]> wrote:

> B2 will focus on deprecating Tk...

The recent abbreviations work has exposed (not for the first time)
some truly ugly features of Leo's key handling.

As part of killing Tk I shall simplify how Leo's Qt gui reports keys
to the core.  The general design will be as follows:

1. The leoKeyEvent class will be strengthened.  The following
improvements will be done in leoKeyEvent or its precursors in
eventFilter.

2. There will be several "invariants" that the core will depend on:

A. event.ch will be empty except for characters that will, by default,
be inserted into body text.  This includes all printable ascii
characters and any unicode characters, but does *not* include any ctrl/
alt/meta characters.

**Important**: there may be (will be) clashes between some unicode
characters and alt/ctrl/meta characters.  I know of no way to guess
what is meant, so all such characters, or at least all such characters
with Leo bindings, will be treated as non-printable.

B. When non-empty, event.ch will contain the *actual character*
represented by the event.  In particular, it will contain '\t', not
'Tab', '\n', not 'Return', '.', not 'period', etc., etc.

C. event.stroke will contain the "standard" spelling of the key.  As
before, k.masterKeyHandler will use the stroke to determine the
binding in effect for the key.  There will be no substantial changes
to k.masterKeyHandler, except as required by invariant B.

The effect of these invariants is that Leo's core will not have to do
AI to determine what character an event refers to.  If event.ch is non-
empty, the character can be inserted (modulo any plain-key bindings).
Otherwise, the stroke tells everything there is to be known about the
key event. This design will eliminate the ridiculous occurrences of
'Tab', 'Return', 'BackSpace' in the core.

k.isPlainKey will become trivial, or better, unnecessary.

None of this can be done easily while Tk exists.  After the work is
done, the work will become a new "standard" that future guis can
implement.

Edward

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en.

Reply via email to