Duplicate text on key release with latched modifiers (Kitty protocol) and Ergo-L keyboard layout #12192
Issue DescriptionWhen the Kitty Keyboard Protocol's report event types Expected BehaviorGhostty should only include a UTF-8 text payload in the escape sequence during Actual BehaviorWhen "report event types" is enabled (flag 2), Ghostty's GTK surface implementation provides a UTF-8 fallback based on the keyval. This fallback is currently active for .release actions. As a result, the escape sequence generated for the release event includes a text payload. Applications that support the Kitty protocol (like Neovim 0.12+) then receive this sequence and process the associated text, leading to a duplicate character being registered on key release (e.g., typing ! produces !!).
Reproduction Steps
You can observe this behavior directly in Neovim 0.12+, or with the command Ghostty LogsNo response Ghostty VersionOS Version InformationArchliunx (Linux only) Display ServerWayland (Linux only) Desktop Environment/Window ManagerReproduced on KDE, Gnome and Niri. Minimal Ghostty ConfigurationReproduced with empty configurationAdditional Relevant Configuration
Potential fix investigated with AI: Restricting the UTF-8 fallback in diff --git a/src/apprt/gtk/class/surface.zig b/src/apprt/gtk/class/surface.zig
index 179c779d7..0d04d9ca1 100644
--- a/src/apprt/gtk/class/surface.zig
+++ b/src/apprt/gtk/class/surface.zig
@@ -1382,7 +1382,7 @@ pub const Surface = extern struct {
// a text value. We have to do this because GTK will not process
// "Ctrl+Shift+1" (on US keyboards) as "Ctrl+!" but instead as "".
// But the keyval is set correctly so we can at least extract that.
- if (priv.im_len == 0 and keyval_unicode > 0) im: {
+ if (action != .release and priv.im_len == 0 and keyval_unicode > 0) im: {
if (std.math.cast(u21, keyval_unicode)) |cp| {
// We don't want to send control characters as IM
// text. Control characters are handled already byI am unsure if this has side effects for other specific layouts. I acknowledge that:
|
Replies: 5 comments 4 replies
|
I have the same issue with my swiss german keyboard, and the ! and ] characters (which are on the same physical key) Note: i tested with "nvim --clean" ,and also tried different settings, to no avail. So not 100% sure if the issue is on the side of neovim or ghostty or a combination. |
|
Ah i see this is a discussion. (i came by link). Will this become an issue as is confirmed? I would love to see it solved so i can use Ghostty!! Thanks devs! |
|
Same thing happening with the swiss french layout. Funnily I just reported this exact same issue to windows terminal which just implemented kitty protocol ;) |








#13861