// Handle ESC that was pending from the previous chunk.
if (this._pendingEscInOsc) {
if (data[i] === '\\') {
// ESC \ = ST terminator, sequence is complete.
i++;
this._inOsc = false;
const payload = this._pendingOsc;
this._pendingOsc = '';
this._handleOscPayload(payload, emitEvent, appendData, ST);
continue;
}
// ESC was not followed by \, malformed: complete the OSC anyway.
this._inOsc = false;