From 5b16b455ff3fd4ad44045facd2549b6419f59636 Mon Sep 17 00:00:00 2001 From: Boris Faure Date: Sun, 6 Jan 2019 22:30:09 +0100 Subject: [PATCH] termptyesc: DL moves the cursor to left margin + tests also remove some debug leftover --- src/bin/termptyesc.c | 4 +- tests/dl.sh | 104 +++++++++++++++++++++++++++++++++++++++++++ tests/tests.results | 1 + 3 files changed, 106 insertions(+), 3 deletions(-) create mode 100755 tests/dl.sh diff --git a/src/bin/termptyesc.c b/src/bin/termptyesc.c index 477826c3..b33dba9e 100644 --- a/src/bin/termptyesc.c +++ b/src/bin/termptyesc.c @@ -2608,7 +2608,6 @@ _handle_esc_csi_il(Termpty *ty, Eina_Unicode **ptr) if (ty->termstate.bottom_margin <= ty->termstate.top_margin) ty->termstate.bottom_margin = ty->termstate.top_margin + 1; } - ERR("arg:%d", arg); for (i = 0; i < arg; i++) { termpty_text_scroll_rev(ty, EINA_TRUE); @@ -2653,6 +2652,7 @@ _handle_esc_csi_dl(Termpty *ty, Eina_Unicode **ptr) } ty->termstate.top_margin = sy1; ty->termstate.bottom_margin = sy2; + ty->cursor_state.cx = ty->termstate.left_margin; } static int @@ -3741,8 +3741,6 @@ _handle_decfi(Termpty *ty) if ((ty->cursor_state.cx == ty->w - 1) && (ty->termstate.lr_margins != 0)) return; - ERR("ty->cursor_state.cx=%d", ty->cursor_state.cx); - ERR("ty->cursor_state.cy=%d", ty->cursor_state.cy); /* cursor forward */ ty->cursor_state.cx++; } diff --git a/tests/dl.sh b/tests/dl.sh new file mode 100755 index 00000000..2c4d8acf --- /dev/null +++ b/tests/dl.sh @@ -0,0 +1,104 @@ +#!/bin/sh + +# fill space +PL=1 +for _ in $(seq 0 23); do + PL=$((PL+1)) + if [ $PL -gt 9 ] ; then + PL=1 + fi + printf '%s' "$PL" + for _ in $(seq 2 $PL); do + printf '#' + done + PR=$((9 - PL)) + for _ in $(seq 0 6); do + printf '\033[0;1m\-' + printf '\033[0;46;1;4m/' + printf '\033[0;46;1;4m|' + printf '\033[0;1;4;7m\\' + printf '\033[0m~' + printf '\033[0;1m_' + printf '\033[0;31;7m>' + printf '\033[0;31;4;7m^' + printf '\033[0;1;7m<' + done + printf '\033[0m' + for _ in $(seq 1 $PR); do + printf '#' + done + printf '%s' "$PR" +done + +# set color +printf '\033[43;34;3m' + +# move +printf '\033[1;10H' +# DL 0 +printf '\033[0M1' +# move +printf '\033[3;10H' +# DL default +printf '\033[M2' +# move +printf '\033[5;10H' +# DL 2 +printf '\033[2M3' + + +# set top/bottom margins: +printf '\033[8;14r' +# allow left/right margins +printf '\033[?69h' +# set left/right margins: +printf '\033[5;75s' + +# move +printf '\033[7;10H' +# outside margins (top), do nothing +printf '\033[M4' +# move +printf '\033[8;4H' +# outside margins(left), do nothing +printf '\033[M5' +# move +printf '\033[15;10H' +# outside margins(bottom), do nothing +printf '\033[M6' +# move +printf '\033[8;76H' +# outside margins(right), do nothing +printf '\033[M7' + +# move +printf '\033[9;10H' +# DL 0 +printf '\033[0M8' +# move +printf '\033[11;10H' +# DL default +printf '\033[M9' +# move +printf '\033[13;10H' +# DL 2 +printf '\033[6M10' + + +# set top/bottom margins: +printf '\033[16;22r' +# restrict cursor +printf '\033[?6h' + +# move +printf '\033[2;4H' +# DL 0 +printf '\033[0M11' +# move +printf '\033[4;4H' +# DL default +printf '\033[M12' +# move +printf '\033[6;4H' +# DL 2 +printf '\033[6M13' diff --git a/tests/tests.results b/tests/tests.results index 781f5112..cb6c6539 100644 --- a/tests/tests.results +++ b/tests/tests.results @@ -59,3 +59,4 @@ ed-3.sh 005871b7e4d63017c08a73ab34f99b14 ed-4.sh 574f37ac24ead26ef86c03d7dfae3152 el.sh abca9d5e5990bed6bd72a7ab9f72b849 il.sh 1788258650a94f2568d05f749b6cf578 +dl.sh e1e0ba19345d2ebf888f5a3e37f27037