about summary refs log tree commit diff
path: root/contrib
diff options
context:
space:
mode:
authorDuncaen <mail@duncano.de>2017-02-02 16:03:10 +0100
committerDuncaen <mail@duncano.de>2017-02-02 16:03:10 +0100
commit113445d9639fbc73b40edf9b727e26c40c3359ab (patch)
tree05d107e1029c3e61b4cb6f3a5480db59ffc2e448 /contrib
parent407a1dc43f134b3c5b5c1bbb1caf8f26fc83abad (diff)
downloadmblaze-113445d9639fbc73b40edf9b727e26c40c3359ab.tar.gz
mblaze-113445d9639fbc73b40edf9b727e26c40c3359ab.tar.xz
mblaze-113445d9639fbc73b40edf9b727e26c40c3359ab.zip
contrib/mvi: fix cmdline and add ! to eval commands
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/mvi17
1 files changed, 12 insertions, 5 deletions
diff --git a/contrib/mvi b/contrib/mvi
index 9bdb229..49b7d8a 100755
--- a/contrib/mvi
+++ b/contrib/mvi
@@ -30,14 +30,21 @@ cmdline() {
 	stty "$stty_default"
 	tput cnorm
 	read -r cmd
+	stty -echo -icanon
 	case "$cmd" in
 		"|"*) ;;
-		"!"*) ;;
+		"!"*)
+			tput sgr0 && tput rmcup # restore to content before mvi
+			eval "${cmd#!*}"
+			# wait for enter, and delete message
+			tput sc; printf "[enter to continue]" && read -r d; tput rc; tput el
+			tput smcup # save new content
+		;;
+		q) close ;;
 	esac
 	printf "%s" "$term_done_cmd"
-	stty -echo -icanon
-	headers
-	body
+	update_body=1
+	draw
 }
 
 update() {
@@ -147,7 +154,7 @@ in_back() {
 
 in_prefix() {
 	n=
-	while [ "$in_key" -le 59 ] && [ "$in_key" -ge 47 ]; do
+	while [ "$in_key" -le 57 ] && [ "$in_key" -ge 48 ]; do
 		: $(( n = n * 10 + $(printf \\$(printf "%03o" "$in_key")) ))
 		in_read
 	done