aboutsummaryrefslogtreecommitdiffstats
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
parentharden the code around manipulation of cursor_state (diff)
downloadterminology-180799d2c504ab77fd1ded226b1ce6e231daff6c.tar.gz
support the REP escape code. Closes https://phab.enlightenment.org/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
int circular_offset2;
Eina_Unicode *buf;
size_t buflen;
+ Eina_Unicode last_char;
unsigned char oldbuf[4];
Termsave *back;
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)
case 'm': // color set
_handle_esc_csi_color_set(ty, &b);
break;
+ case 'b': // repeat last char
+ if (ty->last_char)
+ {
+ arg = _csi_arg_get(&b);
+ TERMPTY_RESTRICT_FIELD(arg, 1, ty->w * ty->h);
+ DBG("REP: repeat %d times last char %x", arg, ty->last_char);
+ for (i = 0; i < arg; i++)
+ termpty_text_append(ty, &ty->last_char, 1);
+ }
+ break;
case '@': // insert N blank chars
arg = _csi_arg_get(&b);
TERMPTY_RESTRICT_FIELD(arg, 1, ty->w * ty->h);
@@ -2049,6 +2059,7 @@ int
termpty_handle_seq(Termpty *ty, const Eina_Unicode *c, const Eina_Unicode *ce)
{
Eina_Unicode *cc;
+ Eina_Unicode last_char = 0;
int len = 0;
/*
@@ -2163,7 +2174,10 @@ termpty_handle_seq(Termpty *ty, const Eina_Unicode *c, const Eina_Unicode *ce)
}
DBG("]");
termpty_text_append(ty, c, len);
+ if (len > 0)
+ last_char = c[len-1];
end:
+ ty->last_char = last_char;
return len;
}