From 789ff23cc13c8ac0b3d49c377e85193f1e3f32e6 Mon Sep 17 00:00:00 2001 From: Stephen <939775+thecodeassassin@users.noreply.github.com> Date: Mon, 22 Jun 2026 23:27:12 +0000 Subject: [PATCH] fix: use tmux-256color default-terminal so tmux exposes extended keys --- static/build/docker-entrypoint | 14 ++++++++++-- static/build/docker-entrypoint_test.sh | 31 ++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 2 deletions(-) diff --git a/static/build/docker-entrypoint b/static/build/docker-entrypoint index 13240d0..ee0c040 100755 --- a/static/build/docker-entrypoint +++ b/static/build/docker-entrypoint @@ -65,15 +65,25 @@ update_tmux_status() { write_tmux_conf() { local conf="/tmp/exitbox-tmux.conf" - local display ws_name ver session_name + local display ws_name ver session_name default_term display="$(agent_display_name "$AGENT")" ws_name="${EXITBOX_WORKSPACE_NAME:-default}" ver="${EXITBOX_VERSION:-dev}" session_name="${EXITBOX_SESSION_NAME:-default}" + # Present tmux-256color to inner apps: unlike xterm-256color, its terminfo + # declares the extended-key capabilities tmux needs to forward modified keys + # (Shift+Enter, etc.) to Kitty-protocol TUIs like Pi. Fall back to + # xterm-256color if that terminfo entry isn't installed. + if infocmp tmux-256color >/dev/null 2>&1; then + default_term="tmux-256color" + else + default_term="xterm-256color" + fi + cat > "$conf" </dev/null + assert_contains "default-terminal prefers tmux-256color" "$with_tmux" 'set -g default-terminal "tmux-256color"' + + # When it is NOT available, fall back to xterm-256color (no breakage). + local without_tmux + without_tmux="$( + AGENT="pi"; EXITBOX_WORKSPACE_NAME="default"; EXITBOX_VERSION="test" + unset EXITBOX_KEYBINDINGS + eval "$PARSE_KB_FUNC"; parse_keybindings + eval "$DISPLAY_FUNC"; eval "$TMUX_CONF_FUNC" + infocmp() { return 1; } + cat "$(write_tmux_conf)" + )" 2>/dev/null + assert_contains "default-terminal falls back to xterm-256color" "$without_tmux" 'set -g default-terminal "xterm-256color"' +} + # ============================================================================ # Test: parse_keybindings defaults (no env var) # ============================================================================ @@ -847,6 +877,7 @@ test_should_exec_raw_detects_auth_keywords test_run_raw_command_prefixes_agent test_build_agent_loop_command_passthrough test_write_tmux_conf_scroll_settings +test_write_tmux_conf_default_terminal test_parse_keybindings_default test_parse_keybindings_custom test_parse_keybindings_partial