mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-15 07:04:45 +00:00
fix(tui): make single-line paste atomic to avoid @ autocomplete lag
closes #1812
This commit is contained in:
parent
49749407fa
commit
689e7b4ac2
3 changed files with 23 additions and 4 deletions
|
|
@ -1496,6 +1496,26 @@ describe("Editor component", () => {
|
|||
assert.strictEqual(editor.getText(), "hello| world");
|
||||
});
|
||||
|
||||
it("does not trigger autocomplete during single-line paste", () => {
|
||||
const editor = new Editor(createTestTUI(), defaultEditorTheme);
|
||||
let suggestionCalls = 0;
|
||||
|
||||
const mockProvider: AutocompleteProvider = {
|
||||
getSuggestions: () => {
|
||||
suggestionCalls += 1;
|
||||
return null;
|
||||
},
|
||||
applyCompletion,
|
||||
};
|
||||
|
||||
editor.setAutocompleteProvider(mockProvider);
|
||||
editor.handleInput("\x1b[200~look at @node_modules/react/index.js please\x1b[201~");
|
||||
|
||||
assert.strictEqual(editor.getText(), "look at @node_modules/react/index.js please");
|
||||
assert.strictEqual(suggestionCalls, 0);
|
||||
assert.strictEqual(editor.isShowingAutocomplete(), false);
|
||||
});
|
||||
|
||||
it("undoes multi-line paste atomically", () => {
|
||||
const editor = new Editor(createTestTUI(), defaultEditorTheme);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue