perf: collapse CSI state guard into single range check

Replace three !== checks (OSC_STRING, DCS_PASSTHROUGH, APC_STRING)
with one < OSC_STRING comparison. States below OSC_STRING are all
safe for the CSI fast-path; states above need the normal table path
for proper subparser abort propagation.
This commit is contained in:
Ismail Pelaseyed
2026-04-23 14:09:47 +02:00
parent 6fd7ecc812
commit 18cd9858ed
+1 -3
View File
@@ -659,9 +659,7 @@ export class EscapeSequenceParser extends Disposable implements IEscapeSequenceP
// CSI fast-path: collapse ESC [ into a single entry, parse params+final in a tight loop
if (code === 0x1b
&& this.currentState !== ParserState.OSC_STRING
&& this.currentState !== ParserState.DCS_PASSTHROUGH
&& this.currentState !== ParserState.APC_STRING
&& this.currentState < ParserState.OSC_STRING
&& i + 1 < length && data[i + 1] === 0x5b
) {
this._params.reset();