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:
committed by
Peter Steinberger
parent
687c41e838
commit
14f56a4e18
@@ -4,6 +4,7 @@ import {
|
|||||||
SelectList,
|
SelectList,
|
||||||
type SelectListTheme,
|
type SelectListTheme,
|
||||||
fuzzyFilter,
|
fuzzyFilter,
|
||||||
|
getEditorKeybindings,
|
||||||
} from "@mariozechner/pi-tui";
|
} from "@mariozechner/pi-tui";
|
||||||
import type { Component } from "@mariozechner/pi-tui";
|
import type { Component } from "@mariozechner/pi-tui";
|
||||||
import chalk from "chalk";
|
import chalk from "chalk";
|
||||||
@@ -109,7 +110,8 @@ export class FilterableSelectList implements Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Escape: clear filter or cancel
|
// Escape: clear filter or cancel
|
||||||
if (keyData === "\x1b" || keyData === "\x1b\x1b") {
|
const kb = getEditorKeybindings();
|
||||||
|
if (kb.matches(keyData, "selectCancel")) {
|
||||||
if (this.filterText) {
|
if (this.filterText) {
|
||||||
this.filterText = "";
|
this.filterText = "";
|
||||||
this.input.setValue("");
|
this.input.setValue("");
|
||||||
|
|||||||
Reference in New Issue
Block a user