From 1cb87c67e8a2848b34ebd845abf01695a02b148f Mon Sep 17 00:00:00 2001 From: Tw93 Date: Sat, 15 Nov 2025 10:01:21 +0800 Subject: [PATCH] esc to q --- bin/touchid.sh | 4 ++-- lib/common.sh | 2 +- lib/menu_paginated.sh | 4 ++-- lib/menu_simple.sh | 4 ++-- mole | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/bin/touchid.sh b/bin/touchid.sh index 7a7ab5b..9fd045a 100755 --- a/bin/touchid.sh +++ b/bin/touchid.sh @@ -142,7 +142,7 @@ show_menu() { echo "" show_status if is_touchid_configured; then - echo -ne "${PURPLE}☛${NC} Press ${GREEN}Enter${NC} to disable, ${GRAY}ESC${NC} to quit: " + echo -ne "${PURPLE}☛${NC} Press ${GREEN}Enter${NC} to disable, ${GRAY}Q${NC} to quit: " IFS= read -r -s -n1 key || key="" echo "" @@ -160,7 +160,7 @@ show_menu() { ;; esac else - echo -ne "${PURPLE}☛${NC} Press ${GREEN}Enter${NC} to enable, ${GRAY}ESC${NC} to quit: " + echo -ne "${PURPLE}☛${NC} Press ${GREEN}Enter${NC} to enable, ${GRAY}Q${NC} to quit: " IFS= read -r -s -n1 key || key="" case "$key" in diff --git a/lib/common.sh b/lib/common.sh index 3593dbf..077606d 100755 --- a/lib/common.sh +++ b/lib/common.sh @@ -296,7 +296,7 @@ read_key() { $'\x7f' | $'\x08') echo "DELETE" ;; # Backspace/Delete key $'\x1b') # ESC sequence - could be arrow key, delete key, or ESC alone - # Read the next two bytes within 1s + # Read the next bytes with 1s timeout for maximum compatibility if IFS= read -r -s -n 1 -t 1 rest 2> /dev/null; then if [[ "$rest" == "[" ]]; then # Got ESC [, read next character diff --git a/lib/menu_paginated.sh b/lib/menu_paginated.sh index 31eb40e..a8d9445 100755 --- a/lib/menu_paginated.sh +++ b/lib/menu_paginated.sh @@ -461,7 +461,7 @@ paginated_multi_select() { "${GRAY}${ICON_NAV_UP}/${ICON_NAV_DOWN}${NC} Navigate" "${GRAY}Space${NC} Select" "${GRAY}Enter${NC} Confirm" - "${GRAY}Q/ESC${NC} Quit" + "${GRAY}Q${NC} Quit" ) _print_wrapped_controls "$sep" "${_segs_basic[@]}" local -a _segs_advanced=( @@ -477,7 +477,7 @@ paginated_multi_select() { "${GRAY}Space${NC} Select" "${GRAY}Enter${NC} Confirm" "${GRAY}/${NC} Filter" - "${GRAY}Q/ESC${NC} Quit" + "${GRAY}Q${NC} Quit" ) _print_wrapped_controls "$sep" "${_segs_simple[@]}" fi diff --git a/lib/menu_simple.sh b/lib/menu_simple.sh index 4496a6b..721ec77 100755 --- a/lib/menu_simple.sh +++ b/lib/menu_simple.sh @@ -124,7 +124,7 @@ paginated_multi_select() { if [[ $total_items -eq 0 ]]; then printf "${clear_line}${GRAY}No items available${NC}\n" >&2 printf "${clear_line}\n" >&2 - printf "${clear_line}${GRAY}Q/ESC${NC} Quit\n" >&2 + printf "${clear_line}${GRAY}Q${NC} Quit\n" >&2 printf "${clear_line}" >&2 return fi @@ -168,7 +168,7 @@ paginated_multi_select() { # Clear any remaining lines at bottom printf "${clear_line}\n" >&2 - printf "${clear_line}${GRAY}${ICON_NAV_UP}/${ICON_NAV_DOWN}${NC} Navigate ${GRAY}|${NC} ${GRAY}Space${NC} Select ${GRAY}|${NC} ${GRAY}Enter${NC} Confirm ${GRAY}|${NC} ${GRAY}Q/ESC${NC} Quit\n" >&2 + printf "${clear_line}${GRAY}${ICON_NAV_UP}/${ICON_NAV_DOWN}${NC} Navigate ${GRAY}|${NC} ${GRAY}Space${NC} Select ${GRAY}|${NC} ${GRAY}Enter${NC} Confirm ${GRAY}|${NC} ${GRAY}Q${NC} Quit\n" >&2 # Clear one more line to ensure no artifacts printf "${clear_line}" >&2 diff --git a/mole b/mole index 4f8d2e7..36c8ad1 100755 --- a/mole +++ b/mole @@ -460,7 +460,7 @@ show_main_menu() { if [[ -t 0 ]]; then printf '\r\033[2K\n' - printf '\r\033[2K%s\n' " ${GRAY}↑/↓${NC} Navigate ${GRAY}|${NC} ${GRAY}Enter${NC} Select ${GRAY}|${NC} ${GRAY}H${NC} Help ${GRAY}|${NC} ${GRAY}ESC${NC} Quit" + printf '\r\033[2K%s\n' " ${GRAY}↑/↓${NC} Navigate ${GRAY}|${NC} ${GRAY}Enter${NC} Select ${GRAY}|${NC} ${GRAY}H${NC} Help ${GRAY}|${NC} ${GRAY}Q${NC} Quit" printf '\r\033[2K\n' fi