aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2019-10-11 19:07:05 -0700
committerBruce Hill <bruce@bruce-hill.com>2019-10-11 19:07:05 -0700
commite9c75a78375cff98bb844d6db8ce15d965cba320 (patch)
treeb75d6d2533a1cddb5be833cc6ac09b8b2c170836
parent4cc2bd59c3fcc877aab1a9060aa3e6d741b63f1a (diff)
Use `tput cvvis` and `tput civis` for cursor visibility and fix for `>`
shell mode not showing cursor.
-rw-r--r--bb.h9
-rw-r--r--bindings.bb2
2 files changed, 6 insertions, 5 deletions
diff --git a/bb.h b/bb.h
index 01be685..79b7d27 100644
--- a/bb.h
+++ b/bb.h
@@ -241,20 +241,21 @@ static const char *bbcmdfn = "bb() {\n"
ASK ";\n"
#else
" [ $# -lt 2 ] && printf '\033[31;1mNot enough args to ask!\033[0m\n' && return 1;\n"
-" printf \"\033[1m%s\033[0m\033[?25h\" \"$2\" >/dev/tty;\n"
-" read $1 </dev/tty >/dev/tty\n"
+" printf \"\033[1m%s\033[0m\" \"$2\" >/dev/tty;\n"
+" tput cvvis >/dev/tty;\n"
+" read $1 </dev/tty >/dev/tty;\n"
#endif
"}\n"
"ask1() {\n"
#ifdef ASK1
ASK1 ";\n"
#else
-" printf \"\033[?25l\" >/dev/tty;\n"
+" tput civis >/dev/tty;\n"
" printf \"\033[1m%s\033[0m\" \"$2\" >/dev/tty;\n"
" stty -icanon -echo >/dev/tty;\n"
" eval \"$1=\\$(dd bs=1 count=1 2>/dev/null </dev/tty)\";\n"
" stty icanon echo >/dev/tty;\n"
-" printf \"\033[?25h\" >/dev/tty;\n"
+" tput cvvis >/dev/tty;\n"
#endif
"}\n"
"confirm() {\n"
diff --git a/bindings.bb b/bindings.bb
index e7a90ea..83b6de3 100644
--- a/bindings.bb
+++ b/bindings.bb
@@ -130,7 +130,7 @@ p: # Page through a file with $PAGER
:: # Run a command
ask cmd ':' && sh -c "$BBSHELLFUNC$cmd" -- "$@"; bb +r; pause
>: # Open a shell
- tput rmcup; $SHELL; bb +r
+ tput rmcup; tput cvvis; $SHELL; bb +r
r,F2: # Rename a file
ask newname "Rename $(printf "\033[33m%s\033[39m" "$(basename "$BBCURSOR")"): " "$(basename "$BBCURSOR")" || exit
r="$(dirname "$BBCURSOR")/$newname" || exit