Skip to content

v0.4.3

Choose a tag to compare

@github-actions github-actions released this 26 Jul 11:08

Zero-config recording under kitty and WezTerm shell integration

kitty's and WezTerm's shell-integration scripts are commonly installed
manually in rc files (kitty's docs recommend it for exec zsh, tmux,
sudo, and SSH setups; wezterm.sh is distributed for exactly this). A
shell inside backscroll run can therefore be emitting their marks with
no backscroll snippet — and now that alone is enough to record:

  • kitty (bash + zsh): command text decoded from the shell-quoted
    133;C;cmdline=%q mark (bash printf %q, zsh print -f %q, including
    $'...' ANSI-C segments and raw semicolons), exit codes from 133;D,
    cwd from kitty's OSC 7 kitty-shell-cwd:// (new: both OSC 7 schemes
    are handled).
  • WezTerm (bash + zsh): command text from the base64
    OSC 1337 SetUserVar=WEZTERM_PROG user var, exit codes from 133;D,
    cwd from OSC 7 file://. The var is consumed — never stored into
    recorded output, so show --raw replay can't clobber your live
    terminal's user vars. Other OSC 1337 traffic (iTerm2 File= images,
    other user vars) passes through untouched.
  • With backscroll's own snippet installed too, nothing double-records
    and the snippet's exact command mark wins.

Found upstream, worked around: wezterm.sh word-splits its own base64

__wezterm_set_user_var encodes with an unquoted
`echo -n "$2" | base64` substitution. GNU base64 wraps at 76
columns, the shell word-splits the lines, and printf re-uses its format
string — so on Linux any command longer than 57 bytes arrives as a
truncated first chunk plus garbage SetUserVar=<line>=<line> sequences.
backscroll detects the split and reassembles the full command line (and
swallows the shrapnel). Caught live: a 125-char command recorded as its
first 57 bytes.

Docs & tests

  • docs/osc133.md: gotcha 13 (kitty's cmdline= is shell-quoted —
    don't split params on ;) and gotcha 14 (the wezterm word-split bug,
    and OSC 7 scheme flavors).
  • New E2E suite shell/test_kitty_wezterm.py: 26 checks in CI against
    the real, pinned kitty.bash, zsh kitty-integration (via kitty's
    documented manual-install block), and wezterm.sh, under both bash
    and zsh — quotes/semicolons, the >57-byte path, Ctrl-C exit 130,
    both OSC 7 schemes, no phantom stubs, no metadata leaks.

Install: curl -sSfL https://raw.githubusercontent.com/soren-achebe/backscroll/main/install.sh | sh · brew install soren-achebe/tap/backscroll · deb/rpm/tarballs below. Fully compatible with 0.4.x databases.