summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Faure <billiob@gmail.com>2017-09-18 22:01:42 +0200
committerBoris Faure <billiob@gmail.com>2017-09-18 22:01:42 +0200
commit180799d2c504ab77fd1ded226b1ce6e231daff6c (patch)
tree94fcdde57391b5f5a7f7d5ee205cd95c9cfa4bb3
parent6100f8f4e3b6dabc46df6b3aad14341925137466 (diff)
support the REP escape code. Closes T6042
-rw-r--r--src/bin/termpty.h1
-rw-r--r--src/bin/termptyesc.c14
2 files changed, 15 insertions, 0 deletions
diff --git a/src/bin/termpty.h b/src/bin/termpty.h
index 6de8d79..309aa4b 100644
--- a/src/bin/termpty.h
+++ b/src/bin/termpty.h
@@ -93,6 +93,7 @@ struct _Termpty
93 int circular_offset2; 93 int circular_offset2;
94 Eina_Unicode *buf; 94 Eina_Unicode *buf;
95 size_t buflen; 95 size_t buflen;
96 Eina_Unicode last_char;
96 unsigned char oldbuf[4]; 97 unsigned char oldbuf[4];
97 Termsave *back; 98 Termsave *back;
98 size_t backsize, backpos; 99 size_t backsize, backpos;
diff --git a/src/bin/termptyesc.c b/src/bin/termptyesc.c
index 027559b..800cdce 100644
--- a/src/bin/termptyesc.c
+++ b/src/bin/termptyesc.c
@@ -1004,6 +1004,16 @@ _handle_esc_csi(Termpty *ty, const Eina_Unicode *c, const Eina_Unicode *ce)
1004 case 'm': // color set 1004 case 'm': // color set
1005 _handle_esc_csi_color_set(ty, &b); 1005 _handle_esc_csi_color_set(ty, &b);
1006 break; 1006 break;
1007 case 'b': // repeat last char
1008 if (ty->last_char)
1009 {
1010 arg = _csi_arg_get(&b);
1011 TERMPTY_RESTRICT_FIELD(arg, 1, ty->w * ty->h);
1012 DBG("REP: repeat %d times last char %x", arg, ty->last_char);
1013 for (i = 0; i < arg; i++)
1014 termpty_text_append(ty, &ty->last_char, 1);
1015 }
1016 break;
1007 case '@': // insert N blank chars 1017 case '@': // insert N blank chars
1008 arg = _csi_arg_get(&b); 1018 arg = _csi_arg_get(&b);
1009 TERMPTY_RESTRICT_FIELD(arg, 1, ty->w * ty->h); 1019 TERMPTY_RESTRICT_FIELD(arg, 1, ty->w * ty->h);
@@ -2049,6 +2059,7 @@ int
2049termpty_handle_seq(Termpty *ty, const Eina_Unicode *c, const Eina_Unicode *ce) 2059termpty_handle_seq(Termpty *ty, const Eina_Unicode *c, const Eina_Unicode *ce)
2050{ 2060{
2051 Eina_Unicode *cc; 2061 Eina_Unicode *cc;
2062 Eina_Unicode last_char = 0;
2052 int len = 0; 2063 int len = 0;
2053 2064
2054/* 2065/*
@@ -2163,7 +2174,10 @@ termpty_handle_seq(Termpty *ty, const Eina_Unicode *c, const Eina_Unicode *ce)
2163 } 2174 }
2164 DBG("]"); 2175 DBG("]");
2165 termpty_text_append(ty, c, len); 2176 termpty_text_append(ty, c, len);
2177 if (len > 0)
2178 last_char = c[len-1];
2166 2179
2167end: 2180end:
2181 ty->last_char = last_char;
2168 return len; 2182 return len;
2169} 2183}