^[control-codes live in libghostty-vt

Operating system commands

OSC 46 Change Log File

Tell xterm which file to log its session to, in a build that can log.

OSC 46 ; Pt ST
ECMA-48
§8.3.89 OSC – Operating System Command, p. 51
xterm
Operating System Commands

xterm can copy everything it receives to a log file, and OSC 46 ; Pt ST names that file. Logging is turned on with the private mode CSI ? 46 h or from xterm’s menu.

Both are compiled out of a default xterm: logging needs --enable-logging (configure.in), and without it OSC 46 is not one of the numbers xterm acts on. Even a build with logging does not let a program choose the file unless it was also built with ALLOWLOGFILECHANGES, since that would let anything written to the terminal overwrite any file its user can; otherwise it rings the bell twice (do_osc).

libghostty-vt has no OSC 46, and ignores it as a default xterm does, so the case passes.

Validation

OSC46-1: Ignored

A
\e]46;/tmp/session.log\a
B
|AB____|
cursor 1,3
reply none
bell 0
Every example on these pages runs in your browser, in libghostty-vt compiled to WebAssembly.