Currently, the pyte stream control sequence parser can enter OSC parsing mode on receipt of either C0 or C1 OSC characters ('\x1b]' and '\x9d' respectively), but would only exit OSC mode on receipt of a BEL ('\x07') or C1 ST character ('\x9c'), but not a C0 ST character ('\x1b\\', i.e. ESC \).
As a result of this, an OSC control character sequence using the C0 string terminator would cause the parser to get 'stuck' in the OSC mode and no further input would be handled correctly.
This PR modifies the parser to collect an additional character after receiving an ESC before applying the 'is this a ST or BEL' logic. We may wish to consider introducing a similar logic for the main loop where C0 OSC and CSI characters are converted to C1 ones (though this would be in a separate PR).
Currently, the pyte stream control sequence parser can enter OSC parsing mode on receipt of either C0 or C1 OSC characters (
'\x1b]'
and'\x9d'
respectively), but would only exit OSC mode on receipt of a BEL ('\x07'
) or C1 ST character ('\x9c'
), but not a C0 ST character ('\x1b\\'
, i.e.ESC \
).As a result of this, an OSC control character sequence using the C0 string terminator would cause the parser to get 'stuck' in the OSC mode and no further input would be handled correctly.
This PR modifies the parser to collect an additional character after receiving an ESC before applying the 'is this a ST or BEL' logic. We may wish to consider introducing a similar logic for the main loop where C0 OSC and CSI characters are converted to C1 ones (though this would be in a separate PR).