Merge pull request #5499 from Roman-Galeev/fix/editor-cursor-move-refresh-autocomplete

fix(tui): re-query autocomplete picker on cursor movement
This commit is contained in:
Mario Zechner
2026-06-08 13:13:05 +02:00
committed by GitHub
2 changed files with 71 additions and 0 deletions

View File

@@ -1742,6 +1742,18 @@ export class Editor implements Component, Focusable {
}
}
}
// Keep an open autocomplete picker in sync with the new cursor
// position: cursor movement changes the text before the cursor, so a
// picker computed for the old position is stale. Re-query so it
// refreshes — or closes when the new position yields no suggestions —
// mirroring insertCharacter()/handleBackspace(). Without this, arrowing
// left from `/cmd ` back into the command name leaves the argument
// picker showing against a `/cmd` prefix (and a Tab there would
// concatenate the stale suggestion onto the partial command name).
if (this.autocompleteState) {
this.updateAutocomplete();
}
}
/**