From c6079ff0469ed245ef7a6cfa06facaba39471106 Mon Sep 17 00:00:00 2001 From: Nicolas De Loof Date: Thu, 16 Jul 2026 09:37:29 +0200 Subject: [PATCH] Add support for the Ghostty terminal Ghostty sets TERM=xterm-ghostty and (on macOS) TERMINFO pointing to its bundled terminfo. That terminfo describes keys in keypad transmit mode (kcuu1=\EOA, khome=\EOH, ...), but this library never emits smkx, so the terminal actually sends the normal-mode sequences (\E[A, \E[H, ...) and every special key is reported as an unrecognized escape sequence. Treat xterm-ghostty like xterm/xterm-256color: use the built-in xterm key table instead of the terminfo entry, which matches what Ghostty emits in normal mode. Signed-off-by: Nicolas De Loof --- terminfo.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/terminfo.go b/terminfo.go index d000b52..459cfd3 100644 --- a/terminfo.go +++ b/terminfo.go @@ -53,6 +53,7 @@ var ( {"screen", screen_keys}, {"xterm", xterm_keys}, {"xterm-256color", xterm_keys}, + {"xterm-ghostty", xterm_keys}, {"rxvt-unicode", rxvt_keys}, {"rxvt-256color", rxvt_keys}, {"linux", linux_keys}, @@ -153,6 +154,7 @@ func setup_term_builtin() error { }{ {"xterm", xterm_keys}, {"xterm-256color", xterm_keys}, + {"ghostty", xterm_keys}, {"rxvt", rxvt_keys}, {"rxvt-unicode", rxvt_keys}, {"rxvt-256color", rxvt_keys},