ssh-tmux mirror: preserve deliberate pane titles

Merged
AU
22d ago
+476-31

Summary

Preserve deliberately set tmux pane titles on ssh-tmux mirror split surfaces while retaining #7836's window-name authority for default hostname titles.

The mirror now carries #{pane_title}, #{host}, and #{host_short} from the control-mode pane snapshot and a live per-pane subscription. A nonempty pane title that differs from both host defaults becomes the surface/control title; otherwise the tmux window name and deterministic pane suffix remain authoritative.

Reproduction

On the remote host:

tmux new -d -s demo; tmux split-window -t demo; tmux select-pane -t demo:1.1 -T build; tmux select-pane -t demo:1.2 -T logs

Attach with cmux ssh-tmux <host>. The mirrored splits now retain build/logs instead of only <window name> [1]/<window name> [2].

Tests

  • Added behavior coverage for deliberate split names and live retitling.
  • Kept the existing #7836 window-name, single-pane, and single→multi coverage.
  • Test-only commit is separate from the fix commit so CI can demonstrate the regression.
  • Local checks: Swift syntax parse, git diff --check, pbxproj normalization check, and test-wiring lint. No local xcodebuild/XCUITest per task constraints.

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.


Summary by cubic

Preserves deliberately set tmux pane titles on ssh-tmux mirrors. Previously panes always showed " [index]"; now mirrors use the pane's intentional title when it differs from tmux's host defaults, live retitles apply immediately, and stale snapshot replies no longer roll titles back.

  • Adds pane-title metadata to pane-rect replies and a per-pane live title refresh-client subscription.
  • Guards snapshot ordering so live title updates win over older pane-rect replies.
  • Batches reflow, cwd, header, and title subscriptions into one refresh-client; unsubscribes header and title together.
  • Leaves pane-border labels unchanged; only surface/tab titles use the deliberate title.
  • Keeps title metadata for pending and retained panes until topology settles, then prunes on teardown; tests cover deliberate titles, live retitles, snapshot precedence, and state pruning.
  • Makes the CLA trigger gate readable on macOS system Bash by replacing Bash 4-only lowercase expansion with a portable tr invocation.

Summary by CodeRabbit

  • New Features

    • Mirrored panes can display intentional tmux pane titles.
    • Pane titles update live when renamed, without rebuilding the layout.
    • Default host-derived titles are filtered out for cleaner surface labels.
  • Bug Fixes

    • Prevented older layout updates from overwriting newer pane-title changes.
    • Improved pane-title consistency while panes are added, removed, or retained during updates.
    • Improved compatibility for automated workflow checks across macOS and Linux environments.
  • Tests

    • Added coverage for title parsing, default-title handling, live updates, retention, and update ordering.