Skip to content

Commit

Permalink
Prevent falling over other iTerm codes
Browse files Browse the repository at this point in the history
  • Loading branch information
sedwards2009 committed May 5, 2024
1 parent 402c09b commit b19d859
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
7 changes: 7 additions & 0 deletions main/src/emulator/ITermParameters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ export class ITermParameters {
this.#parseParameters(params);
}

isFile(): boolean {
return this.#isFile;
}

#parseParameters(params: ControlSequenceParameters): void {
for (let i=0; i<params.getParamCount(); i++) {
let paramString = params.getParameterString(i);
Expand Down Expand Up @@ -71,6 +75,9 @@ export class ITermParameters {
case "inline":
break;

case "SetUserVar":
break;

default:
this._log.warn(`Unknown paramater key '${parts[0]}'.`);
break;
Expand Down
4 changes: 4 additions & 0 deletions main/src/emulator/Term.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ export class Emulator extends TextEmulator implements EmulatorApi {
}

protected _executeITerm(itermParameters: ITermParameters): void {
if (!itermParameters.isFile()) {
return;
}

const buffer = itermParameters.getPayload();
let qimage = new QImage();
if ( ! qimage.loadFromData(buffer)) {
Expand Down
4 changes: 4 additions & 0 deletions main/src/emulator/TextTerm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1993,6 +1993,10 @@ export class TextEmulator implements TextEmulatorApi {
this.#state = ParserState.OSC_ITERM_PAYLOAD;
} else if (codePoint === CODEPOINT_SEMICOLON) {
this.#params.endParameter();
} else if (codePoint === CODEPOINT_BEL) {
this._executeITerm(new ITermParameters(this.#params));
this.#params.reset();
this.#state = ParserState.NORMAL;
} else {
this.#params.appendParameterCodePoint(codePoint);
}
Expand Down

0 comments on commit b19d859

Please sign in to comment.