diff --git a/app/src-tauri/src/host/persistent/tests.rs b/app/src-tauri/src/host/persistent/tests.rs index cbad1d6..818a4d7 100644 --- a/app/src-tauri/src/host/persistent/tests.rs +++ b/app/src-tauri/src/host/persistent/tests.rs @@ -153,7 +153,7 @@ fn the_image_ships_the_config_and_tmux() { "set -g destroy-unattached off", "set -g window-size latest", "set -g default-terminal \"tmux-256color\"", - "set -as terminal-overrides \",xterm*:smcup@:rmcup@:indn@\"", + r#"set -as terminal-overrides ",xterm*:smcup@:rmcup@:indn@:clear=\\E[H""#, ] { assert!(conf.lines().any(|l| l == line), "missing: {line}"); } diff --git a/container/Dockerfile b/container/Dockerfile index f2a0055..1378fd3 100644 --- a/container/Dockerfile +++ b/container/Dockerfile @@ -326,7 +326,8 @@ RUN npx --yes playwright@latest --version \ # `tmux` rides this layer, the last apt layer and the cheapest to change: it # keeps AWS workspaces' terminals alive while the app is closed (one tmux # server per tab, app/src-tauri/src/host/persistent.rs, config -# /etc/triple-c/tmux.conf below). Unused on Docker projects. ~1.2 MB. +# /etc/triple-c/tmux.conf below). Unused on Docker projects. +3 packages +# (tmux, libevent-core, libutempter0), ~1.5 MB installed. ARG APT_REFRESH= RUN echo "apt refresh: ${APT_REFRESH:-unset}" \ && for i in 1 2 3 4 5; do \ diff --git a/container/triple-c-tmux.conf b/container/triple-c-tmux.conf index 662aec6..779467a 100644 --- a/container/triple-c-tmux.conf +++ b/container/triple-c-tmux.conf @@ -35,10 +35,18 @@ set -s set-clipboard on # Draw in xterm.js's normal screen, not its alternate screen, so scrolled-off # output lands in the app's own scrollback and its copy cleanup and link -# detection keep working. `indn@` too: with it tmux scrolls with CSI S (SU), -# and xterm.js's SU deletes the top line instead of saving it to scrollback; -# without it tmux scrolls with plain newlines, which xterm.js keeps. -set -as terminal-overrides ",xterm*:smcup@:rmcup@:indn@" +# detection keep working (smcup@/rmcup@). Two more, both measured by feeding +# tmux's real output into xterm.js: +# * indn@: with it tmux scrolls with CSI S (SU), and xterm.js's SU deletes the +# top line instead of saving it to scrollback (4 of 300 fast lines kept); +# without it tmux scrolls with newlines, which xterm.js keeps (all 300). +# * clear=\E[H: tmux sends `clear` when its client exits, which without an +# alternate screen wiped the session's last screen (Claude's goodbye, the +# shell's last output) from the tab. Its full redraws repaint every row +# anyway (checked: bash `clear`, ED 2, a curses alternate screen, a +# re-attach over an old screen and Claude Code's TUI all match tmux's own +# view of the pane). +set -as terminal-overrides ",xterm*:smcup@:rmcup@:indn@:clear=\\E[H" # The mouse belongs to xterm.js (selection, links, wheel scrollback). set -g mouse off