import { Editor } from "@mariozechner/pi-tui"; /** * Custom editor that handles Escape and Ctrl+C keys for coding-agent */ export class CustomEditor extends Editor { public onEscape?: () => void; public onCtrlC?: () => void; handleInput(data: string): void { // 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; } // Intercept Ctrl+C if (data === "\x03" && this.onCtrlC) { this.onCtrlC(); return; } // Pass to parent for normal handling super.handleInput(data); } }