Fix Escape key handling for Kitty keyboard protocol

Add isEscape() helper that handles both raw (\x1b) and Kitty protocol
(\x1b[27u) Escape sequences. Update all components that check for
Escape key to use the new helper.
This commit is contained in:
Mario Zechner 2025-12-19 02:09:51 +01:00
parent 314ef34ebc
commit f8b6164ecd
11 changed files with 38 additions and 18 deletions

View file

@ -1,4 +1,4 @@
import { Editor, isCtrlC, isCtrlD, isCtrlO, isCtrlP, isCtrlT, isShiftTab } from "@mariozechner/pi-tui";
import { Editor, isCtrlC, isCtrlD, isCtrlO, isCtrlP, isCtrlT, isEscape, isShiftTab } from "@mariozechner/pi-tui";
/**
* Custom editor that handles Escape and Ctrl+C keys for coding-agent
@ -39,7 +39,7 @@ export class CustomEditor extends Editor {
// Intercept Escape key - but only if autocomplete is NOT active
// (let parent handle escape for autocomplete cancellation)
if (data === "\x1b" && this.onEscape && !this.isShowingAutocomplete()) {
if (isEscape(data) && this.onEscape && !this.isShowingAutocomplete()) {
this.onEscape();
return;
}