[master] 0d9f041 More terminal fidelity improvements.

Poul-Henning Kamp phk at FreeBSD.org
Mon Jan 15 07:31:10 UTC 2018


commit 0d9f04186ccd979422fc5f31068e43f79c24eee7
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon Jan 15 07:30:36 2018 +0000

    More terminal fidelity improvements.

diff --git a/bin/varnishtest/tests/a00000.vtc b/bin/varnishtest/tests/a00000.vtc
index d85d51e..02fca74 100644
--- a/bin/varnishtest/tests/a00000.vtc
+++ b/bin/varnishtest/tests/a00000.vtc
@@ -41,3 +41,14 @@ shell -exit 77 -expect {TEST _.vtc skipped} {
 	exec varnishtest -v _.vtc || true
 }
 
+process p1 "ps -lw | grep '[p][s]' ; tty ; sleep 1" -run -screen_dump
+
+process p2 "stty -a ; sleep 1" -run -screen_dump
+
+process p3 -hexdump {stty raw; echo "*" ; dd bs=254 count=1 | tee /tmp/_1} -start
+
+process p3 -need-bytes 2
+
+process p3 -write "\x1b[H\x1b[2J1\x1b[79C2\x08>\x1b[25;1H3\x1b[25;80H4\x08>\x1b[A\x1b[Cv\x1b[22A^\x1b[79D^\x1b[;2H<\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x0a\x08<\x1b[24;Hv\x1b[12;1H111111112222222333333\x0d\x0a111111112222222333333\x0d\x0a111111112222222333333\x0d\x0a111111112222222333333\x0d\x0a\x1b[12;12H\x1b[K\x1b[13;12H\x1b[0K\x1b[14;12H\x1b[1K\x1b[15;12H\x1b[2K\x1b[3;1Hline3 <\x0d\x0a"
+
+process p3 -need-bytes 256 -screen_dump -wait
diff --git a/bin/varnishtest/tests/u00000.vtc b/bin/varnishtest/tests/u00000.vtc
index 1af8263..fe5b798 100644
--- a/bin/varnishtest/tests/u00000.vtc
+++ b/bin/varnishtest/tests/u00000.vtc
@@ -1,9 +1,5 @@
 varnishtest "Simple process tests"
 
-process p6 "ps -lw | grep '[p][s]' ; tty ; sleep 1" -run -screen_dump
-
-process p5 "stty -a ; sleep 1" -run -screen_dump
-
 process p1 "cat" -start
 process p1 -writeln "foo"
 process p1 -need-bytes 3
diff --git a/bin/varnishtest/vtc_term.c b/bin/varnishtest/vtc_term.c
index 6494ddb..cc9d862 100644
--- a/bin/varnishtest/vtc_term.c
+++ b/bin/varnishtest/vtc_term.c
@@ -116,8 +116,14 @@ term_escape(struct term *tp, int c, int n)
 		if (tp->arg[0] == -1) tp->arg[0] = 1;
 		tp->col += tp->arg[0];
 		if (tp->col >= tp->ncol)
-			vtc_fatal(tp->vl, "ANSI C[%d] outside vram",
-			    tp->arg[0]);
+			tp->col = tp->ncol - 1;
+		break;
+	case 'D':
+		// CUB - Cursor backward
+		if (tp->arg[0] == -1) tp->arg[0] = 1;
+		tp->col -= tp->arg[0];
+		if (tp->col < 0)
+			tp->col = 0;
 		break;
 	case 'h':
 		// SM - Set Mode (ignored XXX?)
@@ -206,13 +212,9 @@ term_char(struct term *tp, char c)
 	default:
 		if (c < ' ' || c > '~')
 			c = '?';
-		tp->vram[tp->line][tp->col] = c;
-		if (tp->col == tp->ncol - 1) {
-			tp->col = 0;
-			term_char(tp, '\n');
-		} else {
-			tp->col++;
-		}
+		tp->vram[tp->line][tp->col++] = c;
+		if (tp->col >= tp->ncol)
+			tp->col = tp->ncol - 1;
 	}
 }
 


More information about the varnish-commit mailing list