aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBoris Faure <billiob@gmail.com>2019-01-20 20:09:32 +0100
committerBoris Faure <billiob@gmail.com>2019-01-20 20:09:32 +0100
commit2ffbe38d43088c4d68dd656191b871a02f1f12ca (patch)
tree54ed444a84ec31bcda0f2458a62b53da353f33dc
parenttests: add some on HVP (diff)
downloadterminology-2ffbe38d43088c4d68dd656191b871a02f1f12ca.tar.gz
termptyesc: support aliases for cursor Up/Left + tests
-rw-r--r--src/bin/termptyesc.c6
-rwxr-xr-xtests/cursor-movements-alias.sh62
-rwxr-xr-xtests/cursor-movements.sh12
-rw-r--r--tests/tests.results3
4 files changed, 73 insertions, 10 deletions
diff --git a/src/bin/termptyesc.c b/src/bin/termptyesc.c
index 1ef2089..e65502f 100644
--- a/src/bin/termptyesc.c
+++ b/src/bin/termptyesc.c
@@ -3122,6 +3122,12 @@ _handle_esc_csi(Termpty *ty, const Eina_Unicode *c, const Eina_Unicode *ce)
WRN("TODO: Media Copy (?:%s)", (*b == '?') ? "yes": "no");
ty->decoding_error = EINA_TRUE;
break;
+ case 'j':
+ _handle_esc_csi_cub(ty, &b);
+ break;
+ case 'k':
+ _handle_esc_csi_cuu(ty, &b);
+ break;
case 'l':
_handle_esc_csi_reset_mode(ty, *cc, b, be);
break;
diff --git a/tests/cursor-movements-alias.sh b/tests/cursor-movements-alias.sh
new file mode 100755
index 0000000..1a98eaf
--- /dev/null
+++ b/tests/cursor-movements-alias.sh
@@ -0,0 +1,62 @@
+#!/bin/sh
+
+
+# fill space with E
+printf '\033#8'
+# set color
+printf '\033[46;31;3m'
+# goto 80;25 (CUP) and back to 0;0
+printf '\033[26;80HZ'
+printf '\033[H'
+
+# RIGHT
+# cursor right
+printf '\033[aA\033[2aB\033[;aC'
+# test on boundaries
+printf '\033[2;80HZ\033[aA'
+
+# LEFT
+# go to 12;2 (CUP)
+printf '\033[2;12H'
+# cursor left
+printf 'C\033[jD\033[;jc\033[3jd'
+# Go left on start of line
+printf '\033[2;0HE\033[jF'
+
+# DOWN
+# cursor down
+printf '\033[eG\033[;eH\033[3eI'
+# At Bottom
+printf '\033[26;0HM\033[eN'
+
+# UP
+# cursor up
+# go to 26;6 (CUP)
+printf '\033[26;6H'
+printf 'O\033[kP\033[;kQ\033[0kR'
+# At top
+printf '\033[0;26Hp\033[kq'
+
+# WITH CURSOR RESTRICTION
+# set top/bottom margins:
+printf '\033[10;20r'
+# allow left/right margins
+printf '\033[?69h'
+# set left/right margins:
+printf '\033[15;30s'
+# change color
+printf '\033[0m\033[45;32;1m'
+# fill restricted region with @
+printf '\033[64;10;15;20;30\044x'
+# change color back
+printf '\033[0m\033[46;31;3m'
+# restrict cursor
+printf '\033[?6h'
+# RIGHT
+printf '\033[5;16H#\033[a>'
+# LEFT
+printf '\033[5;0H#\033[j<'
+# UP
+printf '\033[0;5H#\033[k^'
+# DOWN
+printf '\033[11;8H#\033[ev'
diff --git a/tests/cursor-movements.sh b/tests/cursor-movements.sh
index 8c363ef..38772c7 100755
--- a/tests/cursor-movements.sh
+++ b/tests/cursor-movements.sh
@@ -10,17 +10,15 @@ printf '\033[26;80HZ'
printf '\033[H'
# RIGHT
-# cursor right HPR / CUU
-printf 'A\033[aB\033[;aa\033[0ab'
+# cursor right
printf '\033[CA\033[2CB\033[;CC'
# test on boundaries
-printf '\033[1;80HZ\033[aA'
printf '\033[2;80HZ\033[CA'
# LEFT
# go to 12;2 (CUP)
printf '\033[2;12H'
-# cursor left (CUB)
+# cursor left
printf 'C\033[DD\033[;Dc\033[3Dd'
# Go left on start of line
printf '\033[2;0HE\033[DF'
@@ -28,10 +26,8 @@ printf '\033[2;0HE\033[DF'
# DOWN
# cursor down
printf '\033[BG\033[;BH\033[3BI'
-printf '\033[eJ\033[;eK\033[3eL'
# At Bottom
printf '\033[26;0HM\033[BN'
-printf '\033[26;3Hm\033[en'
# UP
# cursor up
@@ -57,12 +53,10 @@ printf '\033[0m\033[46;31;3m'
# restrict cursor
printf '\033[?6h'
# RIGHT
-printf '\033[5;16H#\033[a>'
-printf '\033[6;16H#\033[C>'
+printf '\033[5;16H#\033[C>'
# LEFT
printf '\033[5;0H#\033[D<'
# UP
printf '\033[0;5H#\033[A^'
# DOWN
-printf '\033[11;6H#\033[ev'
printf '\033[11;8H#\033[Bv'
diff --git a/tests/tests.results b/tests/tests.results
index 867a7df..0ea57ec 100644
--- a/tests/tests.results
+++ b/tests/tests.results
@@ -5,7 +5,8 @@ decera-restrict-cursor.sh 89b15109e4e2ade943a2ab3990729931
decera-decfra-extra.sh abfe90a1df148bf15e7bf0d56163c76a
decfra-decera-default-values-restrict-cursor.sh 9710ed6167f2127671dbab2d7dbeb1eb
decfra-decera-default-values-no-restrict-cursor.sh 6508b473da2de3127dd65da0abe0c877
-cursor-movements.sh a9cb18bfd51c0b411c1705ac02abed02
+cursor-movements.sh 5a1959ada102956053dc1e42b57bbc91
+cursor-movements-alias.sh 5a1959ada102956053dc1e42b57bbc91
fonts.sh d0dcea18258b95d5c869aa866fcae10f
cursor-shape-0.sh c91e01b0e859cc043f21d804a01bcd50
cursor-shape-1.sh c91e01b0e859cc043f21d804a01bcd50