Files
Netcatty/components/terminal/runtime/terminalInterruptShortcut.ts
T
陈大猫 7db654d751 [codex] complete Kitty keyboard protocol (#2389)
* feat: complete Kitty keyboard protocol

* test: document Kitty text release behavior
2026-07-22 11:56:53 +08:00

12 lines
527 B
TypeScript

type InterruptShortcutEvent = Pick<KeyboardEvent, "altKey" | "code" | "ctrlKey" | "key" | "metaKey" | "shiftKey">;
export function shouldUseUrgentTerminalInterrupt(
event: InterruptShortcutEvent,
options: { hasSelection: boolean },
): boolean {
if (options.hasSelection) return false;
if (!event.ctrlKey || event.metaKey || event.altKey || event.shiftKey) return false;
if (/^[\x20-\x7e]$/.test(event.key)) return event.key.toLowerCase() === "c";
return event.code === "KeyC" || event.key.toLowerCase() === "c";
}