From 13f55893351929d62f80a8e86ef28c5e78d4b28f Mon Sep 17 00:00:00 2001 From: Ashesh Goplani Date: Fri, 27 Mar 2026 16:16:39 +0800 Subject: [PATCH] fix: restore Kitty keyboard protocol during session attach for Shift+Enter (#445) The TUI disables the Kitty keyboard protocol at startup so Bubble Tea can parse key input. When attaching to a tmux session, this legacy mode persisted, preventing terminals from sending extended key sequences like Shift+Enter (CSI u encoding). Restore the protocol before attach and re-disable it on detach for all four attach paths (local, window, remote create+attach, remote attach). Fixes #445 Committed by Ashesh Goplani --- internal/ui/home.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/internal/ui/home.go b/internal/ui/home.go index 4caa513f7..5a50bb97d 100644 --- a/internal/ui/home.go +++ b/internal/ui/home.go @@ -7081,6 +7081,12 @@ func (a attachCmd) Run() error { // NOTE: Screen clearing is ONLY done in the tea.Exec callback (after Attach returns) // Removing clear screen here prevents double-clearing which corrupts terminal state + // Restore Kitty keyboard protocol so the outer terminal sends extended key + // sequences (Shift+Enter, etc.) through to the tmux session. The TUI disables + // the protocol at startup for Bubble Tea compatibility; re-disable on return. + RestoreKittyKeyboard(os.Stdout) + defer DisableKittyKeyboard(os.Stdout) + ctx := context.Background() return a.session.Attach(ctx, a.detachByte) } @@ -7120,6 +7126,9 @@ type remoteCreateAndAttachCmd struct { } func (r remoteCreateAndAttachCmd) Run() error { + RestoreKittyKeyboard(os.Stdout) + defer DisableKittyKeyboard(os.Stdout) + ctx := context.Background() sessionID, err := r.runner.CreateSession(ctx) if err != nil { @@ -7140,6 +7149,9 @@ type attachWindowCmd struct { } func (a attachWindowCmd) Run() error { + RestoreKittyKeyboard(os.Stdout) + defer DisableKittyKeyboard(os.Stdout) + ctx := context.Background() return a.session.AttachWindow(ctx, a.windowIndex, a.detachByte) } @@ -7173,6 +7185,9 @@ type remoteAttachCmd struct { } func (r remoteAttachCmd) Run() error { + RestoreKittyKeyboard(os.Stdout) + defer DisableKittyKeyboard(os.Stdout) + return r.runner.Attach(r.sessionID) }