Commit 594d60cd authored by Luis Javier Merino's avatar Luis Javier Merino Committed by Tomaz Canabrava
Browse files

VT parser: Support chars >= 0xA0 in OSC parser

Add support in the new parser for chars >= 0xa0 in OSC, DCS, APC, PM,
SOS.  This allows OSC 8 to support non ASCII URLs:

printf '\e]8;;https://example.com/naïve\e\\Link to naïve\e]8;;\e\\\n'

Note that while «Williams, Paul Flo. “A parser for DEC’s ANSI-compatible
video terminals.” VT100.net. https://vt100.net/emu/dec_ansi_parser»
treats codes A0-FF identically to codes 20-7F, this does not seem to be
typical in terminal emulators: only xterm seems to follow this
peculiarity of DEC VTs, which allows:

printf '\e[4\xedtest\e[0m\n'

to be treated as if it had an "m" instead of "\xed", and shows an
underscored "test" in VT102, VT240, and xterm +u8 (use "\xc3\xad" for
xterm -u8).
parent c78aa91f
......@@ -846,7 +846,7 @@ void Vt102Emulation::receiveChars(const QVector<uint> &chars)
}
break;
case DcsPassthrough:
if (cc <= 0x7E) { // 0x18, 0x1A, 0x1B already taken care of
if (cc <= 0x7E || cc >= 0xA0) { // 0x18, 0x1A, 0x1B already taken care of
put(cc);
} else if (cc == 0x9C) {
switchState(Ground, cc);
......@@ -862,7 +862,7 @@ void Vt102Emulation::receiveChars(const QVector<uint> &chars)
}
break;
case OscString:
if (cc >= 0x20 && cc <= 0x7F) {
if ((cc >= 0x20 && cc <= 0x7F) || cc >= 0xA0) {
osc_put(cc);
} else if (cc == 0x07 // recognize BEL as OSC terminator
|| cc == 0x9C) {
......@@ -872,7 +872,7 @@ void Vt102Emulation::receiveChars(const QVector<uint> &chars)
}
break;
case SosPmApcString:
if (cc <= 0x7F) { // 0x18, 0x1A, 0x1B already taken care of.
if (cc <= 0x7F || cc >= 0xA0) { // 0x18, 0x1A, 0x1B already taken care of.
apc_put(cc);
// ignore
} else if (cc == 0x9C) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment