mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-15 14:03:49 +00:00
- Move TUI components into src/tui/ folder - Split out CustomEditor, StreamingMessageComponent, ToolExecutionComponent, FooterComponent - Trim assistant message text content - Add newline after per-message token/cost stats - Improve code organization and maintainability
27 lines
676 B
TypeScript
27 lines
676 B
TypeScript
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);
|
|
}
|
|
}
|