1
0
mirror of https://github.com/tw93/Mole.git synced 2026-02-08 17:19:19 +00:00

feat(ui): add Ctrl+U support and optimize paginated menu performance

This commit is contained in:
tw93
2026-02-07 10:23:35 +08:00
parent f3b288a21b
commit 02843dee74
3 changed files with 428 additions and 370 deletions

View File

@@ -170,6 +170,7 @@ read_key() {
case "$key" in
$'\n' | $'\r') echo "ENTER" ;;
$'\x7f' | $'\x08') echo "DELETE" ;;
$'\x15') echo "CLEAR_LINE" ;; # Ctrl+U (often mapped from Cmd+Delete in terminals)
$'\x1b')
if IFS= read -r -s -n 1 -t 1 rest 2> /dev/null; then
if [[ "$rest" == "[" ]]; then
@@ -230,6 +231,7 @@ read_key() {
'l' | 'L') echo "RIGHT" ;;
$'\x03') echo "QUIT" ;;
$'\x7f' | $'\x08') echo "DELETE" ;;
$'\x15') echo "CLEAR_LINE" ;; # Ctrl+U
$'\x1b')
if IFS= read -r -s -n 1 -t 1 rest 2> /dev/null; then
if [[ "$rest" == "[" ]]; then