1
0
mirror of https://github.com/tw93/Mole.git synced 2026-02-05 11:28:48 +00:00

Enter to select the next step

This commit is contained in:
Tw93
2025-10-14 19:18:03 +08:00
parent 5ec2ca0c46
commit 05e3ec78dc
2 changed files with 31 additions and 3 deletions

View File

@@ -175,8 +175,17 @@ show_cursor() {
# Keyboard input handling (simple and robust)
read_key() {
local key rest
IFS= read -r -s -n 1 key || return 1
local key rest read_status
# Read with explicit status check
IFS= read -r -s -n 1 key
read_status=$?
# Handle read failure (Ctrl+D, EOF, etc.) - treat as quit
if [[ $read_status -ne 0 ]]; then
echo "QUIT"
return 0
fi
# Raw typing mode (filter): map most keys to CHAR:<key>
if [[ "${MOLE_READ_KEY_FORCE_CHAR:-}" == "1" ]]; then