hundredrabbits / Left

Distractionless Writing Tool
http://hundredrabbits.itch.io/left
Other
1.77k stars 142 forks source link

Ctrl + Shift + . for changing fonts also selects next synonym #132

Open rayzhv opened 4 years ago

rayzhv commented 4 years ago

On Windows 10.0.18362 Left v130

When I put the cursor at the end of a word that has synonyms and try to change fonts using the Ctrl + Shift + . shortcut, the font changes successfully but the word gets replaced with the next synonym. This seems to be an unintentional side effect of changing fonts.

codemacabre commented 4 years ago

I've noticed similar behaviour after using almost any shortcut involving Shift. In my particular case, I often use Ctrl + Shift + Left Arrow or Ctrl + Shift + Right Arrow to select several words but due to the synonym dictionary, it seems that the Shift key causes it to replace with a synonym instead.

@rayzhv Do you get the same synonym-changing behaviour by just pressing Shift after initially triggering this with Ctrl + Shift + . ?

codemacabre commented 4 years ago

A cursory glance at the code suggests that this may be the reason: https://github.com/hundredrabbits/Left/blob/f944beea8791c0dcb551f7c61a66b9a1ccefbbe6/desktop/sources/scripts/events.js#L46-L51

My understanding of the keyboard shortcut is for the combination of Shift + Tab to initiate a sort of 'synonym mode', then releasing the Shift would enter the synonym, but it appears that releasing the Shift does this anyway; there doesn't appear to be any check for when to apply a synonym or not, other than whether a synonym is available / selected when the Shift key is released.

@neauoire do you have any flags for when the user is in 'synonym mode' or anything like that, or would you object to something like that being implemented?

Lucaffo commented 3 years ago

I've realized that can be a keyboard layout problem. In most non US Keyboard to do a '[' you have to use shift+alt. In a US keyboard you have to press only the '[' key.

This means that, if you don't have an american keyboard, you can't use most of the shortcuts. 😭