mirror of
https://github.com/earendil-works/pi.git
synced 2026-06-18 15:54:04 +08:00
Fix Escape key to cancel autocomplete before interrupting agent
This commit is contained in:
@@ -21,8 +21,9 @@ class CustomEditor extends Editor {
|
||||
public onCtrlC?: () => void;
|
||||
|
||||
handleInput(data: string): void {
|
||||
// Intercept Escape key
|
||||
if (data === "\x1b" && this.onEscape) {
|
||||
// Intercept Escape key - but only if autocomplete is NOT active
|
||||
// (let parent handle escape for autocomplete cancellation)
|
||||
if (data === "\x1b" && this.onEscape && !this.isShowingAutocomplete()) {
|
||||
this.onEscape();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -749,6 +749,10 @@ export class Editor implements Component {
|
||||
this.autocompletePrefix = "";
|
||||
}
|
||||
|
||||
public isShowingAutocomplete(): boolean {
|
||||
return this.isAutocompleting;
|
||||
}
|
||||
|
||||
private updateAutocomplete(): void {
|
||||
if (!this.isAutocompleting || !this.autocompleteProvider) return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user