Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If typing a keypad key makes a compose sequence invalid, try regular key instead #224

Closed
mike-fabian opened this issue Aug 20, 2021 · 6 comments

Comments

@mike-fabian
Copy link
Owner

mike-fabian commented Aug 20, 2021

$ grep Ø /usr/share/X11/locale/en_US.UTF-8/Compose
<dead_stroke> <O>                       : "Ø"   Oslash # LATIN CAPITAL LETTER O WITH STROKE
<Multi_key> <slash> <O>                 : "Ø"   Oslash # LATIN CAPITAL LETTER O WITH STROKE
<Multi_key> <O> <slash>                 : "Ø"   Oslash # LATIN CAPITAL LETTER O WITH STROKE
<Multi_key> <KP_Divide> <O>             : "Ø"   Oslash # LATIN CAPITAL LETTER O WITH STROKE

This is nonsense, why should the user care whether to use slash or
KP_Divide and why should there be such subtle differences?

If <Multi_key> <slash> <O> and <Multi_key> <O> <slash> both work and produce the same result, then it makes no sense that when using KP_Divide instead of slash, only <Multi_key> <KP_Divide> <O> works but <Multi_key> <O> <KP_Divide> does not.

@mike-fabian mike-fabian created this issue from a note in Mike’s github project board (To do) Aug 20, 2021
@mike-fabian mike-fabian moved this from To do to In progress in Mike’s github project board Aug 20, 2021
@mike-fabian
Copy link
Owner Author

mike-fabian commented Aug 20, 2021

I did submit a merge request for xorg to improve the Compose file to add the missing orders which should then result in the same behaviour for the keypad keys and the regular keys:

https://gitlab.freedesktop.org/xorg/lib/libx11/-/merge_requests/82

https://lists.x.org/archives/xorg-devel/2021-August/058743.html

@mike-fabian
Copy link
Owner Author

Only one response so far:

https://lists.x.org/archives/xorg-devel/2021-August/058744.html

Doesn’t seem to like my improvement ☹

@mike-fabian
Copy link
Owner Author

On top of that, my merge request missed a few sequences like these for example:

<Multi_key> <1> <4>              	: "¼"   onequarter # VULGAR FRACTION ONE QUARTER
<Multi_key> <1> <2>              	: "½"   onehalf # VULGAR FRACTION ONE HALF
<Multi_key> <3> <4>              	: "¾"   threequarters # VULGAR FRACTION THREE QUARTERS

I think these should also work with KP_1, KP_2, KP_3, and KP_4.

@mike-fabian
Copy link
Owner Author

I implemented:

  • if a keypad key is typed and this makes the compose sequence invalid, try the “normal” key instead
  • if a “normal” key is typed and this makes the compose sequence invalid and there is a similar keypad key, try that one instead

This is certainly quite helpful and better than immediately stopping the compose sequence as invalid.

And it still observes what is written in the compose to the letter, so are still some minor differences in the behaviour of keypad keys and “normal” keys if the compose file makes a distinction.

For example:

[mfabian@fedora ~]$ grep '^<Multi_key> <KP_Divide>' /usr/share/X11/locale/en_US.UTF-8/Compose 
<Multi_key> <KP_Divide> <O>      	: "Ø"   Oslash # LATIN CAPITAL LETTER O WITH STROKE
<Multi_key> <KP_Divide> <o>      	: "ø"   oslash # LATIN SMALL LETTER O WITH STROKE
<Multi_key> <KP_Divide> <D>      	: "Đ"   Dstroke # LATIN CAPITAL LETTER D WITH STROKE
<Multi_key> <KP_Divide> <d>      	: "đ"   dstroke # LATIN SMALL LETTER D WITH STROKE
<Multi_key> <KP_Divide> <H>      	: "Ħ"   U0126 # LATIN CAPITAL LETTER H WITH STROKE
<Multi_key> <KP_Divide> <h>      	: "ħ"   U0127 # LATIN SMALL LETTER H WITH STROKE
<Multi_key> <KP_Divide> <L>      	: "Ł"   U0141 # LATIN CAPITAL LETTER L WITH STROKE
<Multi_key> <KP_Divide> <l>      	: "ł"   U0142 # LATIN SMALL LETTER L WITH STROKE
<Multi_key> <KP_Divide> <T>      	: "Ŧ"   U0166 # LATIN CAPITAL LETTER T WITH STROKE
<Multi_key> <KP_Divide> <t>      	: "ŧ"   U0167 # LATIN SMALL LETTER T WITH STROKE
<Multi_key> <KP_Divide> <b>      	: "ƀ"   U0180 # LATIN SMALL LETTER B WITH STROKE
<Multi_key> <KP_Divide> <I>      	: "Ɨ"   U0197 # LATIN CAPITAL LETTER I WITH STROKE
<Multi_key> <KP_Divide> <Z>      	: "Ƶ"   U01B5 # LATIN CAPITAL LETTER Z WITH STROKE
<Multi_key> <KP_Divide> <z>      	: "ƶ"   U01B6 # LATIN SMALL LETTER Z WITH STROKE
<Multi_key> <KP_Divide> <G>      	: "Ǥ"   U01E4 # LATIN CAPITAL LETTER G WITH STROKE
<Multi_key> <KP_Divide> <g>      	: "ǥ"   U01E5 # LATIN SMALL LETTER G WITH STROKE
<Multi_key> <KP_Divide> <i>      	: "ɨ"   U0268 # LATIN SMALL LETTER I WITH STROKE
<Multi_key> <KP_Divide> <U0294> 	: "ʡ"   U02A1 # LATIN LETTER GLOTTAL STOP WITH STROKE
<Multi_key> <KP_Divide> <Cyrillic_GHE> 	: "Ғ"   U0492 # CYRILLIC CAPITAL LETTER GHE WITH STROKE
<Multi_key> <KP_Divide> <Cyrillic_ghe> 	: "ғ"   U0493 # CYRILLIC SMALL LETTER GHE WITH STROKE
<Multi_key> <KP_Divide> <Cyrillic_KA> 	: "Ҟ"   U049E # CYRILLIC CAPITAL LETTER KA WITH STROKE
<Multi_key> <KP_Divide> <Cyrillic_ka> 	: "ҟ"   U049F # CYRILLIC SMALL LETTER KA WITH STROKE
<Multi_key> <KP_Divide> <U04AE> 	: "Ұ"   U04B0 # CYRILLIC CAPITAL LETTER STRAIGHT U WITH STROKE
<Multi_key> <KP_Divide> <U04AF> 	: "ұ"   U04B1 # CYRILLIC SMALL LETTER STRAIGHT U WITH STROKE
<Multi_key> <KP_Divide> <leftarrow> 	: "↚"   U219A # LEFTWARDS ARROW WITH STROKE
<Multi_key> <KP_Divide> <rightarrow> 	: "↛"   U219B # RIGHTWARDS ARROW WITH STROKE
<Multi_key> <KP_Divide> <U2194> 	: "↮"   U21AE # LEFT RIGHT ARROW WITH STROKE
[mfabian@fedora ~]$ 

But:

[mfabian@fedora ~]$ grep '^<Multi_key> <slash>' /usr/share/X11/locale/en_US.UTF-8/Compose 
<Multi_key> <slash> <slash>      	: "\\"   backslash # REVERSE SOLIDUS
<Multi_key> <slash> <less>       	: "\\"   backslash # REVERSE SOLIDUS
<Multi_key> <slash> <asciicircum> 	: "|"   bar # VERTICAL LINE
<Multi_key> <slash> <C>          	: "₡"   U20a1 # COLON SIGN
<Multi_key> <slash> <m>          	: "₥"   U20a5 # MILL SIGN
<Multi_key> <slash> <c>          	: "¢"   cent # CENT SIGN
<Multi_key> <slash> <u> 		: "µ"   mu # MICRO SIGN
<Multi_key> <slash> <O>          	: "Ø"   Oslash # LATIN CAPITAL LETTER O WITH STROKE
<Multi_key> <slash> <o>          	: "ø"   oslash # LATIN SMALL LETTER O WITH STROKE
<Multi_key> <slash> <D>          	: "Đ"   Dstroke # LATIN CAPITAL LETTER D WITH STROKE
<Multi_key> <slash> <d>          	: "đ"   dstroke # LATIN SMALL LETTER D WITH STROKE
<Multi_key> <slash> <H>          	: "Ħ"   U0126 # LATIN CAPITAL LETTER H WITH STROKE
<Multi_key> <slash> <h>          	: "ħ"   U0127 # LATIN SMALL LETTER H WITH STROKE
<Multi_key> <slash> <L>          	: "Ł"   U0141 # LATIN CAPITAL LETTER L WITH STROKE
<Multi_key> <slash> <l>          	: "ł"   U0142 # LATIN SMALL LETTER L WITH STROKE
<Multi_key> <slash> <T>          	: "Ŧ"   U0166 # LATIN CAPITAL LETTER T WITH STROKE
<Multi_key> <slash> <t>          	: "ŧ"   U0167 # LATIN SMALL LETTER T WITH STROKE
<Multi_key> <slash> <b>          	: "ƀ"   U0180 # LATIN SMALL LETTER B WITH STROKE
<Multi_key> <slash> <I>          	: "Ɨ"   U0197 # LATIN CAPITAL LETTER I WITH STROKE
<Multi_key> <slash> <Z>          	: "Ƶ"   U01B5 # LATIN CAPITAL LETTER Z WITH STROKE
<Multi_key> <slash> <z>          	: "ƶ"   U01B6 # LATIN SMALL LETTER Z WITH STROKE
<Multi_key> <slash> <G>          	: "Ǥ"   U01E4 # LATIN CAPITAL LETTER G WITH STROKE
<Multi_key> <slash> <g>          	: "ǥ"   U01E5 # LATIN SMALL LETTER G WITH STROKE
<Multi_key> <slash> <i>          	: "ɨ"   U0268 # LATIN SMALL LETTER I WITH STROKE
<Multi_key> <slash> <U0294>  	: "ʡ"   U02A1 # LATIN LETTER GLOTTAL STOP WITH STROKE
<Multi_key> <slash> <Cyrillic_GHE> 	: "Ғ"   U0492 # CYRILLIC CAPITAL LETTER GHE WITH STROKE
<Multi_key> <slash> <Cyrillic_ghe> 	: "ғ"   U0493 # CYRILLIC SMALL LETTER GHE WITH STROKE
<Multi_key> <slash> <Cyrillic_KA> 	: "Ҟ"   U049E # CYRILLIC CAPITAL LETTER KA WITH STROKE
<Multi_key> <slash> <Cyrillic_ka> 	: "ҟ"   U049F # CYRILLIC SMALL LETTER KA WITH STROKE
<Multi_key> <slash> <U04AE>  	: "Ұ"   U04B0 # CYRILLIC CAPITAL LETTER STRAIGHT U WITH STROKE
<Multi_key> <slash> <U04AF>  	: "ұ"   U04B1 # CYRILLIC SMALL LETTER STRAIGHT U WITH STROKE
<Multi_key> <slash> <leftarrow>  	: "↚"   U219A # LEFTWARDS ARROW WITH STROKE
<Multi_key> <slash> <rightarrow> 	: "↛"   U219B # RIGHTWARDS ARROW WITH STROKE
<Multi_key> <slash> <U2194>  	: "↮"   U21AE # LEFT RIGHT ARROW WITH STROKE
<Multi_key> <slash> <equal>  	: "≠"   U2260 # NOT EQUAL TO
<Multi_key> <slash> <v>                         : "√"   U221a   # / v SQUARE ROOT
<Multi_key> <slash> <minus>                     : "⌿"   U233f   # / - APL FUNCTIONAL SYMBOL SLASH BAR
<Multi_key> <slash> <U2395>                     : "⍁"   U2341   # / ⎕ APL FUNCTIONAL SYMBOL QUAD SLASH
[mfabian@fedora ~]$ 

@mike-fabian
Copy link
Owner Author

I.e. one starts typing <Multi_key> <KP_Divide>, this is still not invalid as this exists in the compose files. So <slash> is not tried as a replacement for <KP_Divide>. And the other way round, if <Multi_key> <slash> is typed, this is also valid so far so <KP_Divide> is not tried as a replacement for <slash>.

But the possible 3rd keysyms are not equal for the sequences starting with <Multi_key> <KP_Divide> and <Multi_key> <slash>!

That means that for example <Multi_key> <slash> <equal> is valid and works but <Multi_key> <KP_Divide> <equal> is invalid and does not work.

It also means that it is still possible to define <Multi_key> <KP_Divide> <equal> in a compose file to give a different result from <Multi_key> <slash> <equal> if one desires! (Why would one want to do something crazy like that?)

@mike-fabian
Copy link
Owner Author

I am considering treating the keypad keys and “normal” keys as if they were exactly the same thing.

If I do that, there would be no difference between <Multi_key> <slash> <equal> and <Multi_key> <KP_Divide> <equal> and it would not be possible to define different results for these sequences in Compose files, the last definition found would win in that case.

Therefore, I won’t do that at the moment, still thinking whether this is a good idea or not to treat these as exactly equal always.

My current improvement still prefers what is in the Compose file if the exact sequence is there but helpfully tries to continue with the replacement keysym if the exact sequence cannot be found.

I think that is quite helpful already, good enough maybe, still giving the contents of the Compose file the final authority.

@mike-fabian mike-fabian self-assigned this Aug 20, 2021
Mike’s github project board automation moved this from In progress to Done Aug 22, 2021
mike-fabian added a commit that referenced this issue Aug 31, 2021
…lence pair

I forgot these in this commit:

commit 61b8c33
Author: Mike FABIAN <mfabian@redhat.com>
Date:   Fri Aug 20 21:10:21 2021 +0200

    If a keypad key makes compose sequence invalid, try sequence with regular keys instead

    Resolves: #224

    (And also the other way round, if a regular key makes a compose
    sequence invalid, try the matching keypad key instead)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

1 participant