xterm.js
xterm.js copied to clipboard
control characters incorrectly ignored in OSC string
trafficstars
Most control characters (including CR and LF) are ignored in OSC_STRING.
This is inconsistent with xterm, which I think we should follow in this respect. See the sos_table in VTPrsTbl.c in the xterm sources: "The CASE_IGNORE entries correspond to the characters that can be accumulated for the string function (e.g., OSC)." I also verified this using the gdb debugger.
A simple fix in EscapeSequenceParse.ts is to replace:
table.addMany(EXECUTABLES, ParserState.OSC_STRING, ParserAction.IGNORE, ParserState.OSC_STRING);
by:
table.addMany(EXECUTABLES, ParserState.OSC_STRING, ParserAction.OSC_PUT, ParserState.OSC_STRING);
Optionally, we can also tweak the handling of ParserAction.OSC_PUT in line 769:
if (j >= length || (code = data[j]) < 0x20 || (code > 0x7f && code < NON_ASCII_PRINTABLE)) {
My suggestion is to not change that line.
I will submit a pull request if this looks reasonable.