leo 6.6-devel linux - strange symbols appear in the editor on 'Win' key press

154 views
Skip to first unread message

gar

unread,
Nov 21, 2021, 6:20:19 AM11/21/21
to leo-editor
Hello.
Why Leo started to enter symbols like ៀ? into it's editor when user presses Win key?
Before this version I was using leo released at May - and there was no such behavior.
I am under ubuntu 20.04 and cant say if the same can be reproduced under Windows.

tbp1...@gmail.com

unread,
Nov 21, 2021, 10:31:28 AM11/21/21
to leo-editor
I remember that problem from earlier this year, even that exact same symbol group.  And it occurred for other keys too (IIRC one was the CONTL key). I don't remember how it was fixed.  I don't get the behavior on the current (well, two days old) devel branch on either Windows or Linux Mint.

gar

unread,
Nov 21, 2021, 2:55:30 PM11/21/21
to leo-e...@googlegroups.com


вс, 21 нояб. 2021 г. в 18:31, tbp1...@gmail.com <tbp1...@gmail.com>:
I remember that problem from earlier this year, even that exact same symbol group.  And it occurred for other keys too (IIRC one was the CONTL key). I don't remember how it was fixed.  I don't get the behavior on the current (well, two days old) devel branch on either Windows or Linux Mint.

Merged 6.6b1  from master right now. Didnt help.
Then merged upstream from 'devel'. Still no result.
This is very sad. Any ideas what to do next?

Edward K. Ream

unread,
Nov 21, 2021, 4:57:27 PM11/21/21
to leo-editor
Be patient :-)  I'll get around to this soon.

Edward

Edward K. Ream

unread,
Nov 24, 2021, 7:57:10 AM11/24/21
to leo-editor
I have just created #2344 for this issue.

Edward

Edward K. Ream

unread,
Dec 9, 2021, 7:45:25 AM12/9/21
to leo-editor
Please run Leo (from a console) with --trace=keys. I'll need to know the constants when you press the "Win" key.

I can't reproduce the problem on my Windows or Ubuntu machines.

Edward

tbp1...@gmail.com

unread,
Dec 9, 2021, 8:00:46 AM12/9/21
to leo-editor
Sounds to me as if Gar was using an earlier version, even though he did a merge.  Not sure how that could be, unless one file somehow didn't get updated.

Edward K. Ream

unread,
Dec 9, 2021, 8:13:03 AM12/9/21
to leo-editor
On Thu, Dec 9, 2021 at 7:00 AM tbp1...@gmail.com <tbp1...@gmail.com> wrote:
Sounds to me as if Gar was using an earlier version, even though he did a merge.  Not sure how that could be, unless one file somehow didn't get updated.

We'll see.

Edward

tbp1...@gmail.com

unread,
Dec 9, 2021, 1:08:30 PM12/9/21
to leo-editor
Many Linux distros, including Ubuntu, intercept the Win key and use it to open the system menu.  How would Leo even be receiving the Win key event?  Someone would have had to reconfigure Ubuntu's handling of that key so that Leo could get it at all.

Edward K. Ream

unread,
Dec 9, 2021, 1:48:15 PM12/9/21
to leo-editor
On Thu, Dec 9, 2021 at 12:08 PM tbp1...@gmail.com <tbp1...@gmail.com> wrote:
Many Linux distros, including Ubuntu, intercept the Win key and use it to open the system menu.  How would Leo even be receiving the Win key event?  Someone would have had to reconfigure Ubuntu's handling of that key so that Leo could get it at all.

Remember that key handling depends on the keyboard :-) Let's not try to "figure it out". We'll have to wait for the key-traces.

Edward

pbg

unread,
Dec 17, 2021, 10:04:47 PM12/17/21
to leo-editor
I see the same behavior with leo v6.5 and v6.4, but not with v6.3.

Playing with python and Leo versions, I got the following result when enabling --trace=keys, and pressing the win-key

Python 3.9.9 (fyi, same result for python 3.7.12) + leo 6.5
        masterKeyHandler None 'ៀ\udc53' <KeyStroke: 'ៀ\udc53'>
        selfInsertCommand ch 'ៀ\udc53'

Python 3.9.9 + leo 6.3
        traceKeys    shortcut-override:         ''
        traceKeys    shortcut-override:         ''
        traceKeys            key-press:         ''
        traceKeys            key-press:         ''
        traceKeys          key-release:    Meta ''
        traceKeys          key-release:    Meta ''

fyi: I'm running Arch Linux and the spectrwm window manager.

gar

unread,
Jan 4, 2022, 3:11:21 AM1/4/22
to leo-e...@googlegroups.com
Hello Edward!

It's now a bit late to answer, but still, here is what I see in the console output (same as in pbg's answer below):

masterKeyHandler None 'ៀ\udc53' <KeyStroke: 'ៀ\udc53'>
selfInsertCommand ch 'ៀ\udc53'

Leo 6.6b2-devel
Python 3.9.4
Ubuntu 20.04

чт, 9 дек. 2021 г. в 15:45, Edward K. Ream <edre...@gmail.com>:
--
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 leo-editor+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/leo-editor/6febbaf1-411c-4e2f-a42c-4ec4ea58a76en%40googlegroups.com.

tbp1...@gmail.com

unread,
Jan 7, 2022, 10:24:54 AM1/7/22
to leo-editor
I just spun up a VM with Ubuntu 20.04 on a Windows host.  I installed Leo 6.6b1 from Pypi using pip. (I had that xcb problem that has happened before, but was able to fix it - This seems to be due to a missing library (see missing xcb problem).  Once Leo was running, I did not have the problem of the bad symbol behavior.  In fact, Ubuntu intercepts this key so Leo should not see it at all.  Maybe if somehow the keyboard map was changed so that the Windows key were not the Ubuntu hotkey, then the problem might arise, hard to say.

gar

unread,
Jan 9, 2022, 4:15:14 PM1/9/22
to leo-e...@googlegroups.com
I get the same with KDE and LXQT on 20.04. If I downgrade Leo - everything works. Also need to mention that I never run Leo from pip - always from sources with a custom python (3.9.4 in my case)
Not sure that it's worthy of investigation right now since stable version is ok. Let's wait for the next release candidate and I'll try it on my setup then.

tbp1...@gmail.com

unread,
Jan 9, 2022, 5:24:46 PM1/9/22
to leo-editor
If you don't have Leo open and you tap the <WIN> key, what happens? Does the application menu open?  Then if you open Leo and tap the same key when Leo isn't focused, does the same thing happen?  And finally, when Leo is focused and you tap that key, does anything different happen (except for Leo getting the weird symbol)?  Because Leo shouldn't be receiving the <WIN> key, I don't think, and it does not on my VM.

Edward K. Ream

unread,
Jan 10, 2022, 8:25:22 AM1/10/22
to leo-editor
On Fri, Jan 7, 2022 at 10:24 AM tbp1...@gmail.com <tbp1...@gmail.com> wrote:
I just spun up a VM with Ubuntu 20.04 on a Windows host.  I installed Leo 6.6b1 from Pypi using pip. (I had that xcb problem that has happened before, but was able to fix it - This seems to be due to a missing library (see missing xcb problem).  Once Leo was running, I did not have the problem of the bad symbol behavior.  In fact, Ubuntu intercepts this key so Leo should not see it at all.  Maybe if somehow the keyboard map was changed so that the Windows key were not the Ubuntu hotkey, then the problem might arise, hard to say.

Thanks for this investigation.

I'd like to add that just because Leo didn't emit byte hash in previous versions doesn't necessarily mean the previous versions were superior to the present code.

Edward

gar

unread,
Mar 7, 2022, 2:06:16 PM3/7/22
to leo-e...@googlegroups.com
Hello, the team!

Can you please tell me what is the status of this issue? Is it going to be investigated? Or you failed to reproduce it and threw it away?
Actually my work with leo is absolutely paralyzed. I use the win-key intensively, even for a kind of alt-tab. Leo outlines become dirty even when I think that I don't use it.
Leo's recent master suffers from it, pip's 6.5 and 6.4 too. The latest version where it doesnt is 6.3.

Maybe the best solution is to downgrade to some version where it is absent and never upgrade. I agree with that too - in case this issue is not going to be fixed.
User pbg at Dec'18 reported that he succeeded to reproduce it and provided you with the trace. Is anything else needed?

Thanks.

tbp1...@gmail.com

unread,
Mar 7, 2022, 4:24:50 PM3/7/22
to leo-editor
It will be fixed after @Edward, myself, or someone else can reliably reproduce the problem.  It happened to me last year - I'm sure it was the exact same problem since the weird symbols were the same - but for the CTRL key instead.  That went away so I thought that it had been fixed.  I know that it was not purely a Qt problem because I wrote a little pyqt test program - not running in Leo - and did not get the bad symbols.

I sympathize because the program is totally unusable this way, but we've got to find something different about your machine/installation.  

I don't recall your history with this now, but are you able to install it without pip and try that?  The best way would be to clone the git repo and run that.  In the worst case, you could also either install a different version of Python, or at least create a new virtual environment to get a clean an install as possible.  If I were doing this, I would pip-install some earlier version of Leo (like 6.3, maybe?) so as to get the dependencies installed.  Then I would run the git-repo clone version.

If you don't know what any of this means, someone here can walk you through it, I'm sure.  I can tell you that I'd feel crippled if I couldn't use Leo any more, so I have some idea how you feel!

tbp1...@gmail.com

unread,
Mar 7, 2022, 4:33:13 PM3/7/22
to leo-editor
I was posting about it around April 13, 2021:

gar

unread,
Mar 8, 2022, 12:35:19 PM3/8/22
to leo-e...@googlegroups.com
Tnanks for your response! Glad to hear that my problem is not only mine.

About the issue. I have several physical boxes with different proc/mem/etc but all running Kubuntu 20.04 (with KDE atop, minimal install).
All of them behave in the same manner.

I do always install pyenv, recent python (3.9 in this case) and leo from git. So I first encountered the issue on this setup.

Then I took system python's pip (3.9.5) and installed 6.5 - same issue. Then 6.4 - no changes. And only 6.3 gave my usable setup.
So now I am on 6.3 from pip with py-395.

I am not sure whether pip re-installs PyQT.

Hope this would help. Thanks.

вт, 8 мар. 2022 г. в 00:33, tbp1...@gmail.com <tbp1...@gmail.com>:
--
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 leo-editor+...@googlegroups.com.

tbp1...@gmail.com

unread,
Mar 8, 2022, 1:03:38 PM3/8/22
to leo-editor
Thanks for this additional information.  Would it be possible for you to install on some other Linux or windows manager?  Say a Mint VM, or even Ubuntu with Cinnamon.  I've got the thing working on Mint - a VM with a Windows host . I've had post-6.3 versions  working on Mint, Ubuntu, and Debian, all with the Cinnamon windows manager.  @Edward would know better, but I think I recall that he wrote that he had revised key handling at some point in there, so maybe that has something to do with it.

Just to tick another box, is your keyboard set for US-EN, or some other locale?  After all, we have to find *something* that is different about your installations!

If all else fails, I could spin up a KUbuntu/KDE VM and see what happens.

gar

unread,
Mar 8, 2022, 1:24:49 PM3/8/22
to leo-e...@googlegroups.com


вт, 8 мар. 2022 г. в 21:03, tbp1...@gmail.com <tbp1...@gmail.com>:
Thanks for this additional information.  Would it be possible for you to install on some other Linux or windows manager?  Say a Mint VM, or even Ubuntu with Cinnamon.  I've got the thing working on Mint - a VM with a Windows host . I've had post-6.3 versions  working on Mint, Ubuntu, and Debian, all with the Cinnamon windows manager.  @Edward would know better, but I think I recall that he wrote that he had revised key handling at some point in there, so maybe that has something to do with it.
Definitely no. My boxes are very outdated and are too weak to run VM on them. They are just typewriters.

Just to tick another box, is your keyboard set for US-EN, or some other locale?  After all, we have to find *something* that is different about your installations!
Generic 101-key
 
$ locale
LANG=en_US.UTF-8

$ setxkbmap -print | grep xkb_symbols
       xkb_symbols   { include "pc+us+ru:2+inet(evdev)+capslock(grouplock)"    };

tbp1...@gmail.com

unread,
Mar 8, 2022, 2:05:49 PM3/8/22
to leo-editor
On Tuesday, March 8, 2022 at 1:24:49 PM UTC-5 gar wrote:

$ setxkbmap -print | grep xkb_symbols
       xkb_symbols   { include "pc+us+ru:2+inet(evdev)+capslock(grouplock)"    };

My current Mint VM: 

tom@tom-VirtualBox:~$ setxkbmap -print | grep xkb_symbols
        xkb_symbols   { include "pc+us+inet(evdev)+terminate(ctrl_alt_bksp)"        };


I wonder if the "+ru" has anything to do with it?

Your symbols indicate that you have another keyboard layout, presumably ":1".  Is that different?  Can you switch to it and see if you still have the problem?

tbp1...@gmail.com

unread,
Mar 8, 2022, 6:12:58 PM3/8/22
to leo-editor
Bingo! I installed a stock KUbuntu from an iso file I just downloaded.  The keyboard is standard for us-en.  I installed pip then Leo.   When I hit the Windows key I get that same symbol group inserted into the body.

I didn't expect that because that key is used by the OS GUI to bring up the system's program menu, and I would have had thought that the key would never get through to Leo.

I also get it for SHIFT-Windows.  I don't get it for ALT or CTRL, or their SHIFT versions. I also get it with SHIFT=Windows on Ubuntu and Debian but not with just the Windows key.  Here's what I get on the latter two:

 ៀ?

Well, now maybe we can make some progress!  Except I don't know anything about Leo's key handling. @Edward, can you install KUbuntu or Debian and track this problem down?

tbp1...@gmail.com

unread,
Mar 8, 2022, 6:22:25 PM3/8/22
to leo-editor
The hex codes for this string are 20 E1 9F 80 3F, for what that's worth.  And yes, it does seem that "20" is part of it and not an accidental addition during copying.

tbp1...@gmail.com

unread,
Mar 8, 2022, 8:14:45 PM3/8/22
to leo-editor
Running with --trace=keys gives this output for SHIFT-Windows, which doesn't help me a lot -

masterKeyHandler None 'ៀ\udc53' <KeyStroke: 'Shift+ៀ\udc53'>
selfInsertCommand ch 'ៀ\udc53'

tbp1...@gmail.com

unread,
Mar 8, 2022, 8:42:16 PM3/8/22
to leo-editor
Without ever learning the cause of this problem, it could be finessed by just ignoring that exact keystroke, like this:

def masterKeyHandler(self, event):
    """The master key handler for almost all key bindings."""
    trace = 'keys' in g.app.debug
    c, k = self.c, self
    # Setup...
    if trace:
        g.trace(repr(k.state.kind), repr(event.char), repr(event.stroke))
    if event.char == 'ៀ\udc53': return


This works on my Debian machine.  It's hard for me to believe that anyone is going to type that exact sequence on purpose.  OTOH, what if on some other installation and OS version some other spurious key gets emitted?  Maybe there should be a new setting

@string ignored-keys = 'ៀ\udc53   # I can't delete that leading apostrophe; this sequence even confuses the browser editor.

Better to find the root cause if possible, but this hack would at least get Leo usable again for the afflicted.

tbp1...@gmail.com

unread,
Mar 8, 2022, 9:00:17 PM3/8/22
to leo-editor
@gar, what do you get for

$ setxkbmap -print | grep xkb_geometry
        xkb_geometry  { include "pc(pc105)"        };  # my VM


gar

unread,
Mar 8, 2022, 11:01:30 PM3/8/22
to leo-e...@googlegroups.com
Hello!
Thank you very much for such a steady investigation.

Here is what you asked:

setxkbmap -print | grep xkb_geometry
       xkb_geometry  { include "pc(pc101)"     };

I dont touch much any settings related to keyboards and layouts - just set up another language and it's switching via KDE configurator.

ср, 9 мар. 2022 г. в 05:00, tbp1...@gmail.com <tbp1...@gmail.com>:

tbp1...@gmail.com

unread,
Mar 8, 2022, 11:07:42 PM3/8/22
to leo-editor
I only wondered if the system thought your keyboard was a 101-key, but really it was a, say, 105 key, whether somehow that might be related.  Probably not likely, I suppose, but I don't know much about keyboards and their specification.

I found one page where the poster had started having problems with the Win key (not this problem), and when they created a new user, the new user didn't have the problem.  I tried it, but the new user has our Leo problem too.

gar

unread,
Mar 9, 2022, 12:03:52 AM3/9/22
to leo-e...@googlegroups.com
I believe this is related to KDE, maybe it's hotkeys manager does something weird.
Did you try to reproduce on the same box where already did but with another window manager (say lxde for simplicity)

tbp1...@gmail.com

unread,
Mar 9, 2022, 3:01:09 PM3/9/22
to leo-editor
Just submitted a PR to fix this by filtering out the 0x1000053 key code on linux.  Worked on both Debian and Kubuntu VMs.

Just be aware that this fix won't work if the Win/SHIFT-Win key code changes in the future.  We still don't know how the symbols actually get generated and inserted, so it's a hack and not a "real" fix.  Also, it's only for the left windows key.  I don't have a computer that has a right Windows key so at present I don't know the key code for. the right Win key.

gar

unread,
Mar 9, 2022, 11:39:30 PM3/9/22
to leo-e...@googlegroups.com
OK, thanks. I'll be keep watching on that and report any strange behaviour.

ср, 9 мар. 2022 г. в 23:01, tbp1...@gmail.com <tbp1...@gmail.com>:
--
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 leo-editor+...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages