Skip to content

Commit

Permalink
Ignore non-handled CSI sequences in terminal suggest
Browse files Browse the repository at this point in the history
  • Loading branch information
Tyriar committed Apr 15, 2024
1 parent 4555840 commit 46201f8
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ export class SuggestAddon extends Disposable implements ITerminalAddon, ISuggest
}
}
// Left
if (data === '\x1b[D') {
else if (data === '\x1b[D') {
// If left goes beyond where the completion was requested, hide
if (this._cursorIndexDelta > 0) {
handled = true;
Expand All @@ -425,14 +425,18 @@ export class SuggestAddon extends Disposable implements ITerminalAddon, ISuggest
}
}
// Right
if (data === '\x1b[C') {
else if (data === '\x1b[C') {
// If right requests beyond where the completion was requested (potentially accepting a shell completion), hide
if (this._additionalInput?.length !== this._cursorIndexDelta) {
handled = true;
this._cursorIndexDelta++;
handledCursorDelta++;
}
}
// Other CSI sequence (ignore)
else if (data.match(/^\x1b\[.+[a-z@\^`{\|}~]$/i)) {
handled = true;
}
if (data.match(/^[a-z0-9]$/i)) {

// TODO: There is a race here where the completions may come through after new character presses because of conpty's rendering!
Expand Down

0 comments on commit 46201f8

Please sign in to comment.