aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2023-08-24 23:10:10 -0700
committerKaz Kylheku <kaz@kylheku.com>2023-08-24 23:10:10 -0700
commitb8bc0295ba6bb9dfddb8c1ccbe530ecedf8188a4 (patch)
tree72b7d8d5135fdf9180d016a568609b5c542f649c
parent1bc984704ce4452ff85e68cfa2223a932fa67f4f (diff)
downloadbasta-b8bc0295ba6bb9dfddb8c1ccbe530ecedf8188a4.tar.gz
basta-b8bc0295ba6bb9dfddb8c1ccbe530ecedf8188a4.tar.bz2
basta-b8bc0295ba6bb9dfddb8c1ccbe530ecedf8188a4.zip
Improve TTY handling in basta.check_cursor.
- We don't save and restore the TTY settings. They might not be good anyway. We go for "stty sane". - Add -echo to raw mode. I'm seeing a glitch whereby if I hold down the Enter key, sometimes I see ^M being echoed; this makes it go away.
-rw-r--r--basta.sh5
1 files changed, 2 insertions, 3 deletions
diff --git a/basta.sh b/basta.sh
index 1c8fe93..7ed53cf 100644
--- a/basta.sh
+++ b/basta.sh
@@ -70,8 +70,7 @@ basta.update_status()
basta.check_cursor()
{
- local saved_tty=$(stty -g)
- stty raw
+ stty raw -echo
if ! read -t 0; then
local exit=$?
@@ -83,7 +82,7 @@ basta.check_cursor()
fi
fi
- stty "$saved_tty"
+ stty sane
}
basta.do_exit_status()