mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-21 05:02:14 +00:00
Fix Escape key to cancel autocomplete before interrupting agent
This commit is contained in:
parent
dc1e2f928b
commit
97e00fc45d
2 changed files with 7 additions and 2 deletions
|
|
@ -21,8 +21,9 @@ class CustomEditor extends Editor {
|
||||||
public onCtrlC?: () => void;
|
public onCtrlC?: () => void;
|
||||||
|
|
||||||
handleInput(data: string): void {
|
handleInput(data: string): void {
|
||||||
// Intercept Escape key
|
// Intercept Escape key - but only if autocomplete is NOT active
|
||||||
if (data === "\x1b" && this.onEscape) {
|
// (let parent handle escape for autocomplete cancellation)
|
||||||
|
if (data === "\x1b" && this.onEscape && !this.isShowingAutocomplete()) {
|
||||||
this.onEscape();
|
this.onEscape();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -749,6 +749,10 @@ export class Editor implements Component {
|
||||||
this.autocompletePrefix = "";
|
this.autocompletePrefix = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public isShowingAutocomplete(): boolean {
|
||||||
|
return this.isAutocompleting;
|
||||||
|
}
|
||||||
|
|
||||||
private updateAutocomplete(): void {
|
private updateAutocomplete(): void {
|
||||||
if (!this.isAutocompleting || !this.autocompleteProvider) return;
|
if (!this.isAutocompleting || !this.autocompleteProvider) return;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue