A fix for abbreviations with foreign keyboards is in the #1563 branch

78 views
Skip to first unread message

Edward K. Ream

unread,
May 10, 2020, 11:05:08 AM5/10/20
to leo-editor
This fix involves a tweak to Leo's lowest level key-handling code, namely filter.doAltTweaks. No change to Leo's abbreviation code seems to be necessary.

Although the change appears slight, it might have significant ramifications. Indeed, my first attempt (in devel) failed. I backed out of the change and made what looks like the correct change in the #1563 branch.

Please test the code now. I'll wait for a day before merging.

Edward

Viktor Ransmayr

unread,
May 10, 2020, 2:22:52 PM5/10/20
to leo-editor
Hello Edward
I tried to test - but - did not succeed :-(

Since it is the first time that I'm trying to work on a Git branch, it might well be that the problem is on my side ;-)

The first (strange?) thing I've to report is that after I did a 'git pull' - and - tried to do a 'git checkout #1563'  the system responded with

(Leo-Repo) [user@fedora-leo-study-vm leo-editor]$ git checkout #1563
Your branch is up to date with 'origin/devel'.
(Leo-Repo) [user@fedora-leo-study-vm leo-editor]$ git branch
* devel
  master
(Leo-Repo) [user@fedora-leo-study-vm leo-editor]$


I then re-installed Leo performing

(Leo-Repo) [user@fedora-leo-study-vm leo-editor]$ cd ..
(Leo-Repo) [user@fedora-leo-study-vm Leo-Repo]$ pip install --editable ./leo-editor
Obtaining file:///home/user/PyVE/Repo/Leo-Repo/leo-editor
 
Installing build dependencies ... done
 
Getting requirements to build wheel ... done
   
Preparing wheel metadata ... done
Requirement already satisfied: PyQtWebEngine in ./lib/python3.7/site-packages (from leo==6.2.dev173) (5.14.0)
...


I then started the newly installed instance

Leo Log Window
Leo 6.3-devel, devel branch, build a65c3df00e
2020-05-10 09:48:22 -0500
Python 3.7.7, PyQt version 5.14.2
linux
setting leoID
from os.getenv('USER'): 'user'
current dir
: /home/user/PyVE/Repo/Leo-Repo
load dir
: /home/user/PyVE/Repo/Leo-Repo/leo-editor/leo/core
global config dir: /home/user/PyVE/Repo/Leo-Repo/leo-editor/leo/config
home dir
: /home/user
reading settings
in /home/user/PyVE/Repo/Leo-Repo/leo-editor/leo/config/leoSettings.leo
reading settings
in /home/user/.leo/myLeoSettings.leo
reading settings
in /home/user/Documents/SL2020.leo
read outline
in 0.20 seconds


but none of the configured abbreviations worked ...


Try to use this newly installed instance of 'leo-repo' for the first time - OK. - See "Log-004".

* Note 1: I closed the currently running instance of 'leo-stable' before!
* Note 2: 'leo-repo' is running "Leo 6.3-devel, devel branch, build a65c3df00e"

Try out abbreviation date;; - Not OK.

Try out abbreviation html;; - Not OK.

Try out abbreviations ts;; - Not OK.


Please let me know what else you want me to try.

With kind regards,

Viktor

Brian Theado

unread,
May 10, 2020, 2:53:26 PM5/10/20
to leo-editor
Viktor,

On Sun, May 10, 2020 at 2:22 PM Viktor Ransmayr <viktor....@gmail.com> wrote:
Since it is the first time that I'm trying to work on a Git branch, it might well be that the problem is on my side ;-)

The first (strange?) thing I've to report is that after I did a 'git pull' - and - tried to do a 'git checkout #1563'  the system responded with

(Leo-Repo) [user@fedora-leo-study-vm leo-editor]$ git checkout #1563
Your branch is up to date with 'origin/devel'.
(Leo-Repo) [user@fedora-leo-study-vm leo-editor]$ git branch
* devel
  master
(Leo-Repo) [user@fedora-leo-study-vm leo-editor]$

 
In Linux shell, the '#' character indicates the start of a comment, so to git your command came through as just 'git checkout' and it did nothing. Try putting quotes around the branch name to keep the shell from seeing it as a comment:

$ git checkout '#1563'
Branch '#1563' set up to track remote branch '#1563' from 'origin'.
Switched to a new branch '#1563'

Brian

Viktor Ransmayr

unread,
May 10, 2020, 3:38:42 PM5/10/20
to leo-editor
Hello Brian, hello Edward,
@Brian: Thanks a lot for your explanation & help!

@Edward: I can report (partial) success in my environment. - Here's the log from my last test:

Try to activate branch '#1563' - OK. - See "Log-001".

Try to install Leo from development branch - OK. - See "Log-002".

Try to use this newly installed instance of 'leo-repo' for the first time - OK. - See "Log-003".


* Note 1: I closed the currently running instance of 'leo-stable' before!
* Note 2: 'leo-repo' is running "Leo 6.3-devel, #1563 branch, build 4ea4179199"

Try out abbreviation #1 - OK.

Sun May 10 20:23:19 2020



Try out abbreviation #2 - OK.

<html>
<head>
<title>title</title>
<style>
</style>
</head>
<body>
<|content|>
</body>
</html>



Tryout abbreviation #3 - Not OK.

ts;;

The  setting in outline 'myLeoSettings.leo' for this abbreviation is as follows:

...

# this abbreviation will only work with @bool scripting-abbreviations = True
# (or @bool scripting-at-script-nodes = True)
date
;;={|{x=time.asctime()}|}
ts
;;={|{x=time.strftime("%Y%m%d%H%M%S")}|}

...

With kind regards,

Viktor

Edward K. Ream

unread,
May 11, 2020, 9:02:11 AM5/11/20
to leo-editor
On Sun, May 10, 2020 at 2:38 PM Viktor Ransmayr <viktor....@gmail.com> wrote:

QQQ
@Edward: I can report (partial) success in my environment. - Here's the log from my last test:

Try out abbreviation #1 - OK. [EKR: This is the "date" abbreviation]
Try out abbreviation #2 - OK. [EKR: This is the "html" abbreviation]
Try out abbreviation #3 - Not OK.

ts;;
QQQ

This works for me. It looks like your definition of this is the same the one in my myLeoSettings.leo file.

Imo, there should be no problems in abbreviations that use only "ascii" characters, that is, characters ch for which 20 <= ord(ch) <= 127. That is true in the abbreviations you tested.

Are you switching between English and German keyboards, as I am doing when I look at this issue? All sorts of strange things happen when I forget to switch back to the English keyboard.

Rev 4ea4179 merges the #1653 branch into devel. It's time for further testing.

In future I'll name bug-related branches bug-nnnn instead of #nnnn so as to avoid problems in Linux.

Edward

Viktor Ransmayr

unread,
May 11, 2020, 1:46:42 PM5/11/20
to leo-e...@googlegroups.com
Hello Edward,

Am Mo., 11. Mai 2020 um 15:02 Uhr schrieb Edward K. Ream <edre...@gmail.com>:
On Sun, May 10, 2020 at 2:38 PM Viktor Ransmayr <viktor....@gmail.com> wrote:

QQQ
@Edward: I can report (partial) success in my environment. - Here's the log from my last test:

Try out abbreviation #1 - OK. [EKR: This is the "date" abbreviation]
Try out abbreviation #2 - OK. [EKR: This is the "html" abbreviation]
Try out abbreviation #3 - Not OK.

ts;;
QQQ

This works for me. It looks like your definition of this is the same the one in my myLeoSettings.leo file.

Imo, there should be no problems in abbreviations that use only "ascii" characters, that is, characters ch for which 20 <= ord(ch) <= 127. That is true in the abbreviations you tested.

Are you switching between English and German keyboards, as I am doing when I look at this issue? All sorts of strange things happen when I forget to switch back to the English keyboard.

No, all my tests were performed using the 'physical' german keyboard coming with my laptop. - I never switched to a 'virtual' english keyboard ;-)

Rev 4ea4179 merges the #1653 branch into devel. It's time for further testing.

I'll give it a try later in the evening & report back.

With kind regards,

Viktor

Viktor Ransmayr

unread,
May 11, 2020, 3:02:56 PM5/11/20
to leo-editor
Hello Edward,
It's now official: abbreviations still don't fully work, when using a german keyboard. - See my notes ...

Activate development branch - OK. - See "Log-001".


Try to install Leo from development branch - OK. - See "Log-002".

Try to use this newly installed instance of 'leo-repo' - OK. - See "Log-003".


* Note 1: I closed the currently running instance of 'leo-stable' before!
* Note 2: 'leo-repo' is running "Leo 6.3-devel, devel branch, build 4ea4179199"

Try out abbreviation 'date' - Mon May 11 19:47:01 2020 - OK.

Try out abbreviation 'ts' - ts;; - Still not OK.


Do you want me to deliver a log with --trace=keys enabled - or - what else should I do?

With kind regards,

Viktor

Edward K. Ream

unread,
May 12, 2020, 9:19:44 AM5/12/20
to leo-editor
On Mon, May 11, 2020 at 2:02 PM Viktor Ransmayr <viktor....@gmail.com> wrote:

> Do you want me to deliver a log with --trace=keys enabled

Yes. You can omit everything except the keys corresponding to ts;;

Also, please tell me whether you have changed any @bool settings in "Keyboard and minibuffer options" in leoSettings. That is, please report if any of these appear in your myLeoSettings.leo.

Thanks.

Edward
Message has been deleted

Viktor Ransmayr

unread,
May 12, 2020, 2:58:49 PM5/12/20
to leo-editor
Hello Edward,
The error was on my side :-(

I was sure, I had my own abbreviation-settings active in the 'myLeoSettings' outline - but - I just found out that they were commented out - and - only the default abbreviation-settings from the 'leoSettings' outline were active ...

Obviously 'ts;;' was not defined there. - With my own abbreviation-settings active everything's fine now.

Sorry for creating additional work on your side!

With kind regards,

Viktor

Edward K. Ream

unread,
May 12, 2020, 4:44:34 PM5/12/20
to leo-editor

On Tue, May 12, 2020 at 1:58 PM Viktor Ransmayr <viktor....@gmail.com> wrote:

> The error was on my side :-(

That's good news. I'll close this issue once again.

Edward
Reply all
Reply to author
Forward
0 new messages