mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-18 01:00:25 +00:00
Add Kitty keyboard protocol support for Shift+Enter and other modifier keys
Enable the Kitty keyboard protocol on terminal start to receive enhanced key sequences that include modifier information. This fixes Shift+Enter not working in Ghostty, Kitty, WezTerm, and other modern terminals. Changes: - Enable Kitty protocol on start (\x1b[>1u), disable on stop (\x1b[<u) - Add centralized key definitions in packages/tui/src/keys.ts - Support both legacy and Kitty sequences for all modifier+key combos: - Shift+Enter, Alt+Enter for newlines - Shift+Tab for thinking level cycling - Ctrl+C, Ctrl+A, Ctrl+E, Ctrl+K, Ctrl+U, Ctrl+W, Ctrl+O, Ctrl+P, Ctrl+T - Alt+Backspace for word deletion - Export Keys constants and helper functions from @mariozechner/pi-tui
This commit is contained in:
parent
2f86c8bc3c
commit
4a4531f887
10 changed files with 182 additions and 47 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import { type Component, Container, Spacer, Text, truncateToWidth } from "@mariozechner/pi-tui";
|
||||
import { type Component, Container, Keys, Spacer, Text, truncateToWidth } from "@mariozechner/pi-tui";
|
||||
import { theme } from "../theme/theme.js";
|
||||
import { DynamicBorder } from "./dynamic-border.js";
|
||||
|
||||
|
|
@ -99,8 +99,8 @@ class UserMessageList implements Component {
|
|||
this.onCancel();
|
||||
}
|
||||
}
|
||||
// Ctrl+C - cancel
|
||||
else if (keyData === "\x03") {
|
||||
// Ctrl+C - cancel (raw byte or Kitty keyboard protocol)
|
||||
else if (keyData === "\x03" || keyData === Keys.CTRL_C) {
|
||||
if (this.onCancel) {
|
||||
this.onCancel();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue