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

@ -3,7 +3,7 @@
* Displays a list of string options with keyboard navigation.
*/
import { Container, isArrowDown, isArrowUp, isEnter, isEscape, Spacer, Text } from "@mariozechner/pi-tui";
import { Container, isArrowDown, isArrowUp, isCtrlC, isEnter, isEscape, Spacer, Text } from "@mariozechner/pi-tui";
import { theme } from "../theme/theme.js";
import { DynamicBorder } from "./dynamic-border.js";
@ -83,8 +83,8 @@ export class HookSelectorComponent extends Container {
this.onSelectCallback(selected);
}
}
// Escape
else if (isEscape(keyData)) {
// Escape or Ctrl+C
else if (isEscape(keyData) || isCtrlC(keyData)) {
this.onCancelCallback();
}
}