summary refs log tree commit diff
diff options
context:
space:
mode:
-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