[master] 9bdc5f75d Implement and test ECMA-48 "REP" sequence.

Poul-Henning Kamp phk at FreeBSD.org
Mon Sep 24 11:26:18 UTC 2018


commit 9bdc5f75d661a1659c4df60799612a7524a6caa7
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon Sep 24 08:31:37 2018 +0000

    Implement and test ECMA-48 "REP" sequence.
    
    Fixes: #2668

diff --git a/bin/varnishtest/gensequences b/bin/varnishtest/gensequences
index e82e56ec7..4337186b8 100644
--- a/bin/varnishtest/gensequences
+++ b/bin/varnishtest/gensequences
@@ -158,6 +158,7 @@ for (p in l_prefix_name) {
 
 	if (l_prefix_name[p] != "teken_state_init") {
 		print "";
+		print "\tt->t_last = 0;";
 		print "\tteken_state_switch(t, teken_state_init);";
 	}
 	print "}";
diff --git a/bin/varnishtest/sequences b/bin/varnishtest/sequences
index d8f30306b..50f589626 100644
--- a/bin/varnishtest/sequences
+++ b/bin/varnishtest/sequences
@@ -114,3 +114,6 @@ C25VTSW		Cons25 switch virtual terminal		^[ [ z		r
 
 # VT52 compatibility
 #DECID		VT52 DECID				^[ Z
+
+# ECMA-48
+REP		Repeat last graphic char		^[ [ b		n
diff --git a/bin/varnishtest/teken.h b/bin/varnishtest/teken.h
index eb59817d7..c08a2bbb8 100644
--- a/bin/varnishtest/teken.h
+++ b/bin/varnishtest/teken.h
@@ -157,6 +157,7 @@ struct __teken {
 
 	unsigned int	 t_utf8_left;
 	teken_char_t	 t_utf8_partial;
+	teken_char_t	 t_last;
 
 	unsigned int	 t_curscs;
 	teken_scs_t	*t_saved_curscs;
diff --git a/bin/varnishtest/teken_subr.h b/bin/varnishtest/teken_subr.h
index 22d06bb19..644e502f6 100644
--- a/bin/varnishtest/teken_subr.h
+++ b/bin/varnishtest/teken_subr.h
@@ -798,10 +798,11 @@ teken_subr_primary_device_attributes(const teken_t *t, unsigned int request)
 }
 
 static void
-teken_subr_do_putchar(const teken_t *t, const teken_pos_t *tp, teken_char_t c,
+teken_subr_do_putchar(teken_t *t, const teken_pos_t *tp, teken_char_t c,
     int width)
 {
 
+	t->t_last = c;
 	if (t->t_stateflags & TS_INSERT &&
 	    tp->tp_col < t->t_winsize.tp_col - width) {
 		teken_rect_t ctr;
@@ -1334,3 +1335,12 @@ teken_subr_vertical_position_absolute(teken_t *t, unsigned int row)
 	t->t_stateflags &= ~TS_WRAPPED;
 	teken_funcs_cursor(t);
 }
+
+static void
+teken_subr_repeat_last_graphic_char(teken_t *t, unsigned int rpts)
+{
+
+	for (; t->t_last != 0 && rpts > 0; rpts--)
+		teken_subr_regular_character(t, t->t_last);
+}
+
diff --git a/bin/varnishtest/tests/a00001.vtc b/bin/varnishtest/tests/a00001.vtc
index ea5b458f3..3647e01e3 100644
--- a/bin/varnishtest/tests/a00001.vtc
+++ b/bin/varnishtest/tests/a00001.vtc
@@ -204,6 +204,27 @@ process p4 -writehex 0d
 process p4 -expect-text 21 11 "Enter choice number (0 - 12):"
 process p4 -screen_dump
 
+# 11. Test non-VT100 (e.g., VT220, XTERM) terminals
+process p4 -writehex "31 31 0d"
+process p4 -expect-text 0 0 "Menu 11: Non-VT100 Tests"
+
+process p4 -writehex "37 0d"
+process p4 -expect-text 0 0 "Menu 11.7: Miscellaneous ISO-6429 (ECMA-48) Tests"
+
+process p4 -writehex "32 0d"
+process p4 -expect-text 0 0 "Push <RETURN>"
+process p4 -screen_dump
+process p4 -expect-text 20 1 "Test Repeat (REP)"
+process p4 -expect-text 1 1 " ++ "
+process p4 -expect-text 2 2 " ++ "
+process p4 -expect-text 17 17 " ++ "
+process p4 -expect-text 18 18 "*++*"
+process p4 -writehex "0d"
+process p4 -expect-text 0 0 "Menu 11.7: Miscellaneous ISO-6429 (ECMA-48) Tests"
+process p4 -writehex "30 0d"
+process p4 -expect-text 0 0 "Menu 11: Non-VT100 Tests"
+process p4 -writehex "30 0d"
+
 # 0. Exit
 process p4 -writehex "30 0d"
 process p4 -expect-text 12 30 "That's all, folks!"


More information about the varnish-commit mailing list