mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-21 04:00:10 +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
|
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
- Fixed TUI width calculation for regional indicator symbols (e.g. partial flag sequences like `🇨` during streaming) to prevent wrap drift and stale character artifacts in differential rendering.
|
- Fixed TUI width calculation for regional indicator symbols (e.g. partial flag sequences like `🇨` during streaming) to prevent wrap drift and stale character artifacts in differential rendering.
|
||||||
- Fixed Kitty CSI-u handling to ignore unsupported modifiers so modifier-only events do not insert stray printable characters ([#1807](https://github.com/badlogic/pi-mono/issues/1807))
|
- Fixed Kitty CSI-u handling to ignore unsupported modifiers so modifier-only events do not insert stray printable characters ([#1807](https://github.com/badlogic/pi-mono/issues/1807))
|
||||||
|
- Fixed single-line paste performance by inserting pasted text atomically instead of character-by-character, preventing repeated `@` autocomplete scans during paste ([#1812](https://github.com/badlogic/pi-mono/issues/1812))
|
||||||
|
|
||||||
## [0.55.4] - 2026-03-02
|
## [0.55.4] - 2026-03-02
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1029,10 +1029,8 @@ export class Editor implements Component, Focusable {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pastedLines.length === 1) {
|
if (pastedLines.length === 1) {
|
||||||
// Single line - insert character by character to trigger autocomplete
|
// Single line - insert atomically (do not trigger autocomplete during paste)
|
||||||
for (const char of filteredText) {
|
this.insertTextAtCursorInternal(filteredText);
|
||||||
this.insertCharacter(char, true);
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1496,6 +1496,26 @@ describe("Editor component", () => {
|
||||||
assert.strictEqual(editor.getText(), "hello| world");
|
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", () => {
|
it("undoes multi-line paste atomically", () => {
|
||||||
const editor = new Editor(createTestTUI(), defaultEditorTheme);
|
const editor = new Editor(createTestTUI(), defaultEditorTheme);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue