The keys2 branch is now code complete

56 views
Skip to first unread message

Edward K. Ream

unread,
Apr 18, 2018, 5:53:53 AM4/18/18
to leo-editor
I plan no further work on #423: Simplify key handling with a better KeyStroke class.

I'll merge the keys2 branch into devel in a few days.  Once that happens I'll close #423.

Please test the keys2 branch thoroughly, and report any problems.

Edward

Karsten Wolf

unread,
Apr 18, 2018, 6:45:53 AM4/18/18
to leo-editor
OSX 10.10, cheap Logitech keyboard with german key layout, current leo keys branch with my mac shortcuts: https://github.com/karstenw/leo-shortcuts-osx 

Two differences I found while quick checking the branch. I am not sure if the differences found originate from keys2.

pro:
Improved forward word selection. I can now do propper mac-like forward word selects. I used to go to the end of the word and select backwards. 

con:
Occasionally, when fiddling with alt-left and alt-right (forward and backward word) leo inserts the text "NumLock".

It seems to be related to the time difference between alt and left/right key presses.

The best way I found to reproduce the effect is fast alternating presses on the alt and right keys. See the attachment for a demo.


Leo-NumLock-insertion.mov.zip

Edward K. Ream

unread,
Apr 18, 2018, 10:38:45 AM4/18/18
to leo-editor
On Wed, Apr 18, 2018 at 5:45 AM, 'Karsten Wolf' via leo-editor <leo-e...@googlegroups.com> wrote:

OSX 10.10, cheap Logitech keyboard with german key layout, current leo keys branch with my mac shortcuts: https://github.com/karstenw/leo-shortcuts-osx 

​Excellent. This is a very useful test platform for the "keys2" branch.
 
Two differences I found while quick checking the branch. I am not sure if the differences found originate from keys2.

​Very likely they do.​
 

Occasionally, when fiddling with alt-left and alt-right (forward and backward word) leo inserts the text "NumLock".

​I'll look into this.

Edward

Edward K. Ream

unread,
Apr 18, 2018, 10:45:22 AM4/18/18
to leo-editor
On Wednesday, April 18, 2018 at 4:53:53 AM UTC-5, Edward K. Ream wrote:

I plan no further work on #423: Simplify key handling with a better KeyStroke class.

This is a good time to say that the process of completing a project can take an arbitrarily long time, especially for a project as tricky as this.  Karsten Wolf is exercising some tricky code, for which I am grateful.  And I have just remember a few other minor items that should be dealt with now.

Otoh, #862 ValueError: list.remove(x): x not in list deserves quick attention.

Finally, switching branches has revealed some serious problems in how Leo loads external files.  I'll file a bug report soon.

Edward

Edward K. Ream

unread,
Apr 18, 2018, 12:27:57 PM4/18/18
to leo-editor
On Wed, Apr 18, 2018 at 9:38 AM, Edward K. Ream <edre...@gmail.com> wrote:


Occasionally, when fiddling with alt-left and alt-right (forward and backward word) leo inserts the text "NumLock".

​Rev 34cafe202 adds an experimental test for NumLock in the KeyStroke class.

Does it help?

Edward

Edward K. Ream

unread,
Apr 18, 2018, 2:35:56 PM4/18/18
to leo-editor
On Wednesday, April 18, 2018 at 9:45:22 AM UTC-5, Edward K. Ream wrote:

This is a good time to say that the process of completing a project can take an arbitrarily long time.

Indeed yes.  Recent revs use what I am calling my "new programming style".  I'll discuss this later in a new thread.

The present code doesn't handle backspace properly when there is selected text in a headline.  This is incredibly annoying, and must be fixed.

Edward

Karsten Wolf

unread,
Apr 18, 2018, 3:28:57 PM4/18/18
to leo-editor

 

Does it help?

Edward

The "Numlock" behavior  is gone.

Perhaps you should add a line to the log that tells us which key combo was received. As I understand it, only the symptom is cured.



Further testing:

The Numpad-Enter key inserts the byte $03 into the text. It usually worked to end editing a headline. No more.

###

The "NumLock" episode made me think "what does the 'NumLock' key produce?

The text "Clear". With the cursor after the 'C'.

###

This made me go systematically through all keys:

'äöüß' throw an exception:


Traceback (most recent call last):

  File "/Volumes/Luna/python/github/Leo/leo-editor-clone-git/leo/plugins/qt_events.py", line 100, in eventFilter
    k.masterKeyHandler(key_event)

  File "/Volumes/Luna/python/github/Leo/leo-editor-clone-git/leo/core/leoKeys.py", line 3166, in masterKeyHandler
    k.checkKeyEvent(event)

  File "/Volumes/Luna/python/github/Leo/leo-editor-clone-git/leo/core/leoKeys.py", line 3226, in checkKeyEvent
    c.check_event(event)

  File "/Volumes/Luna/python/github/Leo/leo-editor-clone-git/leo/core/leoCommands.py", line 1939, in check_event
    elif trace or k.isPlainKey(stroke):

  File "/Volumes/Luna/python/github/Leo/leo-editor-clone-git/leo/core/leoKeys.py", line 4385, in isPlainKey
    return stroke.isPlainKey()

  File "/Volumes/Luna/python/github/Leo/leo-editor-clone-git/leo/core/leoGlobals.py", line 563, in isPlainKey
    return unicodedata.category(s).startswith('C')

TypeError: category() argument 1 must be unicode, not str


The rest of the keys can be used normally and shifted.

###


The keys with ALT.

Oh. This is a complete new can of worms.

It took me a while to understand that many of alt-anychar are now commands.

On OSX the ALT key can be used for commands only with F1-F18, INS,DEL, CURSORS, page up/down, pos1, End,

Or in combination with Command (CTRL in Leo) or CRTL (Meta).

The standard key assignments for OSX must not have any of:

ALT-[1-9a-z-+.,<>^äöüß´]

For better understanding I attached the normal, ALTED and SHIFT-ALT german keyboard layouts.


keys3.png
keys2.png
keys1.png

Edward K. Ream

unread,
Apr 26, 2018, 2:00:05 PM4/26/18
to leo-editor


On Wed, Apr 18, 2018 at 2:28 PM, 'Karsten Wolf' via leo-editor <leo-e...@googlegroups.com> wrote:

​Are you having any problems with devel at present?

Edward

Karsten Wolf

unread,
Apr 26, 2018, 4:00:12 PM4/26/18
to leo-editor
None that I am aware of. But I haven't done much the last 3 days since I'm transitioning from 10.10 to 10.12. Almost complete. I just verified that devel:leo runs and the usual suspects behave.

-karsten

Edward K. Ream

unread,
Apr 26, 2018, 5:15:53 PM4/26/18
to leo-editor
On Thu, Apr 26, 2018 at 3:00 PM, 'Karsten Wolf' via leo-editor <leo-e...@googlegroups.com> wrote:
None that I am aware of. But I haven't done much the last 3 days since I'm transitioning from 10.10 to 10.12. Almost complete. I just verified that devel:leo runs and the usual suspects behave.

​Thanks for this status report. There is plenty of time to fix any problems that do arise.

Edward
Reply all
Reply to author
Forward
0 new messages