Handle ctrlc like escape in selectors (#400)

Cheers @nicokosi
This commit is contained in:
Armin Ronacher 2026-01-02 22:43:39 +01:00 committed by GitHub
parent 1e7d991a25
commit 345fa975f1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 24 additions and 14 deletions

View file

@ -2,7 +2,7 @@
* Simple text input component for hooks.
*/
import { Container, Input, isEnter, isEscape, Spacer, Text } from "@mariozechner/pi-tui";
import { Container, Input, isCtrlC, isEnter, isEscape, Spacer, Text } from "@mariozechner/pi-tui";
import { theme } from "../theme/theme.js";
import { DynamicBorder } from "./dynamic-border.js";
@ -52,8 +52,8 @@ export class HookInputComponent extends Container {
return;
}
// Escape to cancel
if (isEscape(keyData)) {
// Escape or Ctrl+C to cancel
if (isEscape(keyData) || isCtrlC(keyData)) {
this.onCancelCallback();
return;
}