mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-03-31 02:32:49 -05:00
Parse DCS commands too
[ECMA-48] section 8.3.27 specifies the format of Device Control String (DCS) commands which are used for XTGETTCAP and other sequences. We don't parse DCS commands. This causes this command to wrongly output some characters: printf '\033P+q616d\033\\' Fix that by parsing DCS commands just like other OSC-like commands. (Apart from the initial characters, DCS has the same format as OSC.) We also allow 0x07 as sequence terminator which does not seem specified but a lot of people use it with OSC; it's fine because 0x07 is not allowed in the OSC/DCS payload. [ECMA-48]: https://www.ecma-international.org/wp-content/uploads/ECMA-48_2nd_edition_august_1979.pdf
This commit is contained in:
parent
24a2ede773
commit
2b00d599d3
@ -3240,7 +3240,7 @@ static void do_osc(Terminal *term)
|
||||
}
|
||||
break;
|
||||
default:
|
||||
/* APC, SOS and PM are recognised as control sequences but
|
||||
/* DCS, APC, SOS and PM are recognised as control sequences but
|
||||
* ignored. PuTTY implements no support for any of them. */
|
||||
break;
|
||||
}
|
||||
@ -4128,10 +4128,11 @@ static void term_out(Terminal *term, bool called_from_term_data)
|
||||
term->esc_args[0] = 0;
|
||||
term->esc_nargs = 1;
|
||||
break;
|
||||
case 'P': /* DCS: Device Control String */
|
||||
case 'X': /* SOS: Start of String */
|
||||
case '^': /* PM: privacy message */
|
||||
case '_': /* APC: application program command */
|
||||
/* SOS, PM, and APC sequences are just a string, terminated
|
||||
/* DCS, SOS, PM, and APC sequences are just a string, terminated
|
||||
* by ST or (I've observed in practice for APC) ^G. That
|
||||
* is, they have the same termination convention as OSC. So
|
||||
* we handle them by going straight into OSC_STRING state
|
||||
@ -4139,7 +4140,8 @@ static void term_out(Terminal *term, bool called_from_term_data)
|
||||
* OSC. */
|
||||
compatibility(OTHER);
|
||||
term->termstate = SEEN_OSC;
|
||||
term->osc_type = (c == 'X' ? OSCLIKE_SOS :
|
||||
term->osc_type = (c == 'P' ? OSCLIKE_DCS :
|
||||
c == 'X' ? OSCLIKE_SOS :
|
||||
c == '^' ? OSCLIKE_PM : OSCLIKE_APC);
|
||||
term->osc_strlen = 0;
|
||||
term->esc_args[0] = 0;
|
||||
|
@ -77,8 +77,9 @@ typedef enum {
|
||||
OSCLIKE_OSC,
|
||||
OSCLIKE_OSC_W,
|
||||
OSCLIKE_APC,
|
||||
OSCLIKE_SOS,
|
||||
OSCLIKE_DCS,
|
||||
OSCLIKE_PM,
|
||||
OSCLIKE_SOS,
|
||||
} OscType;
|
||||
|
||||
struct terminal_tag {
|
||||
|
Loading…
x
Reference in New Issue
Block a user