openstenoproject / plover

Open source stenotype engine
http://opensteno.org/plover
GNU General Public License v2.0
2.35k stars 279 forks source link

Plover doesn’t output accented letters correctly, among other characters on the third level #1620

Open casperdewith opened 1 year ago

casperdewith commented 1 year ago

description

Some characters are on the third or fourth level of a keyboard layout. If a dictionary entry contains such a character, and you stroke its outline, then Plover doesn’t input this character correctly.

to reproduce this behaviour

  1. Use a keyboard layout with characters on the third level, e.g. the US-international keyboard layout.
    • This means that such characters can only be input while holding the third-level key; usually AltGr.
  2. Stroke SA/SRA in a text field. In main.json, this maps to ça va.

expected outputça va
actual output,a va

For context, on the US-international keyboard, the ç key can (only) be input with the combination AltGr+,. Hence, I think that Plover can find the right key to press, but cannot figure out how to deal with the third level and AltGr.

operating system

hardware

The Polyglot keyboard, with standard settings as described in this documentation.

user202729 commented 1 year ago

Things you can try to do:

Some notes

Worth noting the code did take this into account

                if 4 <= keysym_index <= 5:
                    # 3rd (AltGr) level.
                    modifiers |= X.Mod5Mask

I cannot confirm the issue trying to do the above.

Another thing worth checking is whether the last entry is empty

In [17]: engine._keyboard_emulation.modifier_mapping
Out[17]: 
[array('B', [50, 62, 0, 0]),
 array('B', [66, 0, 0, 0]),
 array('B', [37, 105, 0, 0]),
 array('B', [64, 108, 204, 205]),
 array('B', [77, 0, 0, 0]),
 array('B', [203, 0, 0, 0]),
 array('B', [133, 134, 206, 207]),
 array('B', [92, 0, 0, 0])]

xinput type <string> works correctly. Checking with xev shows it does not send a keydown-keyup for the AltGr itself. With some testing I can confirm it's because of the line

    XkbLockGroup(xdo->xdpy, XkbUseCoreKbd, key->group);

where setting the group to 2 makes pressing , output ç.

If I recalled correctly python-xlib does not support Xkb though.

seangenabe commented 1 year ago

Based on my (limited) knowledge of keyboard emulation, implementation of Unicode input would be dependent on the operating system. Ref: https://github.com/qmk/qmk_firmware/blob/master/docs/feature_unicode.md#2-input-modes-idinput-modes

Don't know if this is going to be relevant though.

Monniasza commented 10 months ago

I get "cava" instead.