kovidgoyal / kitty

Cross-platform, fast, feature-rich, GPU based terminal
https://sw.kovidgoyal.net/kitty/
GNU General Public License v3.0
23.96k stars 968 forks source link

[Enhancement] Default Dead Key Behavior (Diacritic/Accents) #7922

Closed Theluga closed 2 hours ago

Theluga commented 2 hours ago

Is your feature request related to a problem? Please describe. What is the desired "default" behavior?

You need to have a keyboard with accents and diacritics like US-International, Portuguese ABNT2 etc.

On Firefox, Geany, Libre Office, Gnome-Terminal etc. If I press the key "~" it will show a "preview diacritic".

If I press a second key that will have a combination like "a" or "n", it will become "ã" or "ñ".

If I press a key that will not combine like "/" or "L" it will become "~/" or "~L".

This is the default behavior of accents and diacritics.

There is also the old behavior where the key would not show a preview (pressing "^" one time would be invisible until a combination like "ê" or a non combination "^L" and of course, pressing space or the same dead key would appear the proper key "^".

The problem:

I wanted to change my default terminal "gnome-terminal" to another one:

I tried Kitty with the following problem:

If I press a dead key accent or diacritic like ~ it will not show a preview (okay, maybe it's the old behavior, no fuss). And when I press a combination, it behaves as expected like "ã" however when I press / to go to my Downloads folder like "~/Downloads" it will delete the "~" and become only "/Downloads".

That is frustrating since going to home directory, need to press "~"two times or"~" and "space" before "/" and this is quite unusual.

Describe the solution you'd like when I press a diacritic or accent like ^ it shows a preview with "^" and if I press another key it becomes a combination like "ô" or becomes two characters like "^p"

kovidgoyal commented 2 hours ago

There are no previews of diacritics in XCompose. If you want that, use an IME system like ibus. If you are on wayland it will work out of the box if you are on X11 you need to set the GLFW_IM_MODULE=ibus env var.

Theluga commented 2 hours ago

I'm on wayland, but the biggest problem is not the preview but the deletion of the first key if it's not a combination like ~/will become only /

kovidgoyal commented 1 hour ago

That behavior will come from the IME system, not kitty. Run kitty with --debug-input and you will see that the ime system sends kitty a discard compose sequence event rather than a commit event. kitty simply follows whatever the IME system tells it to do.

Theluga commented 1 hour ago

So, since I'm using xkb and when I compose non combined characters as specified in https://xkbcommon.org/doc/current/group__compose.html In the cancellation, part. I guess I can not replay the entire sequence like in 3...

[42.178] Press xkb_keycode: 0x28 clean_sym: dead_tilde compose not complete, ignoring.
[42.258] Release xkb_keycode: 0x28 clean_sym: dead_tilde mods: numlock glfw_key: 0 (UNKNOWN) xkb_key: 65107 (dead_tilde) alternate_key: 39 ('�)
[42.890] Press xkb_keycode: 0x59 clean_sym: slash compose not complete, ignoring.
[42.970] Release xkb_keycode: 0x59 clean_sym: slash mods: numlock glfw_key: 47 (/�) xkb_key: 47 (slash)

Well, thank you!