Hide terminal suggest when completions are no longer valid

Fixes #211190
This commit is contained in:
Daniel Imms 2024-04-24 10:18:57 -07:00
parent aacda1dd2f
commit 20f31cbad3
No known key found for this signature in database
GPG key ID: E5CF412B63651C69

View file

@ -142,6 +142,13 @@ export class SuggestAddon extends Disposable implements ITerminalAddon, ISuggest
this._currentPromptInputState = promptInputState;
// Hide the widget if the cursor moves to the left of the initial position as the
// completions are no longer valid
if (this._currentPromptInputState.cursorIndex < this._initialPromptInputState.cursorIndex) {
this.hideSuggestWidget();
return;
}
if (this._terminalSuggestWidgetVisibleContextKey.get()) {
const inputBeforeCursor = this._currentPromptInputState.value.substring(0, this._currentPromptInputState.cursorIndex);
this._cursorIndexDelta = this._currentPromptInputState.cursorIndex - this._initialPromptInputState.cursorIndex;