TUI: use editor keybindings for select cancel action

Replace hardcoded escape sequence checks with the pi-tui keybindings API to ensure consistent cancel handling across different terminal configurations.
This commit is contained in:
CJ Winslow
2026-01-18 15:50:27 -08:00
committed by Peter Steinberger
parent 687c41e838
commit 14f56a4e18

View File

@@ -4,6 +4,7 @@ import {
SelectList,
type SelectListTheme,
fuzzyFilter,
getEditorKeybindings,
} from "@mariozechner/pi-tui";
import type { Component } from "@mariozechner/pi-tui";
import chalk from "chalk";
@@ -109,7 +110,8 @@ export class FilterableSelectList implements Component {
}
// Escape: clear filter or cancel
if (keyData === "\x1b" || keyData === "\x1b\x1b") {
const kb = getEditorKeybindings();
if (kb.matches(keyData, "selectCancel")) {
if (this.filterText) {
this.filterText = "";
this.input.setValue("");