Add helper functions for key detection and update usage

- Add isCtrlA/C/E/K/O/P/T/U/W helper functions that check both raw and Kitty formats
- Add isAltBackspace helper function
- Refactor editor.ts, input.ts, select-list.ts to use helper functions
- Refactor custom-editor.ts, session-selector.ts, user-message-selector.ts
- Add CHANGELOG entry for the Shift+Enter fix
This commit is contained in:
Ahmed Kamal 2025-12-18 19:28:43 +02:00
parent 4a4531f887
commit c3c2bffc68
9 changed files with 146 additions and 50 deletions

View file

@ -1,4 +1,4 @@
import { type Component, Container, Input, Keys, Spacer, Text, truncateToWidth } from "@mariozechner/pi-tui";
import { type Component, Container, Input, isCtrlC, Spacer, Text, truncateToWidth } from "@mariozechner/pi-tui";
import type { SessionManager } from "../../../core/session-manager.js";
import { fuzzyFilter } from "../../../utils/fuzzy.js";
import { theme } from "../theme/theme.js";
@ -144,8 +144,8 @@ class SessionList implements Component {
this.onCancel();
}
}
// Ctrl+C - exit process (raw byte or Kitty keyboard protocol)
else if (keyData === "\x03" || keyData === Keys.CTRL_C) {
// Ctrl+C - exit process
else if (isCtrlC(keyData)) {
process.exit(0);
}
// Pass everything else to search input