summaryrefslogtreecommitdiff
path: root/src/tui_terminal.zig
diff options
context:
space:
mode:
authort <t@tjp.lol>2026-06-08 12:24:09 -0600
committert <t@tjp.lol>2026-06-08 12:25:55 -0600
commitb5eb3f1776a540a55d5675f786a4421c49a6283d (patch)
treea6ba0a59d7dc736f833b69280b089563ee93ca64 /src/tui_terminal.zig
parente5ed00c52bb10aec811734c5568c881c41e58474 (diff)
proper terminal capability negotiation
determine support for the kitty protocol and then pick output sequences accordingly. tested on ghostty (supports kitty) and tmux-in-ghostty (tmux does not support kitty protocol) with shift+enter as newline.
Diffstat (limited to 'src/tui_terminal.zig')
-rw-r--r--src/tui_terminal.zig8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/tui_terminal.zig b/src/tui_terminal.zig
index c4545e9..0f8b3d9 100644
--- a/src/tui_terminal.zig
+++ b/src/tui_terminal.zig
@@ -116,7 +116,13 @@ fn winchHandler(sig: posix.SIG) callconv(.c) void {
pub const Capabilities = struct {
/// Terminal is believed to support synchronized output (mode 2026).
synchronized_output: bool,
- /// Terminal is believed to support the Kitty keyboard protocol.
+ /// Whether the Kitty keyboard protocol is in effect. Initially an env-sniffed
+ /// best guess (see `detectCapabilities`); the app then runs a startup
+ /// query/response handshake (`negotiate_query`) and overwrites this with the
+ /// confirmed result — true if the terminal acknowledged Kitty flags, false
+ /// if it fell back to modifyOtherKeys. Decode logic that depends on the live
+ /// protocol reads the module-global `tui_input.kittyActive()`, which the app
+ /// keeps in sync.
kitty_keyboard: bool,
};