aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2020-01-20 17:37:20 +0000
committerDaniel Eklöf <daniel@ekloef.se>2020-01-20 17:45:14 +0000
commit4e874267129b8f70af23d33d1a3163a26d75cc99 (patch)
tree3692c6a186f54a15d8d5c48246824ca44221f82b
parentrender: fallback to background color if cursor text color is not set (diff)
csi: implement REP - CSI Ps b
-rw-r--r--csi.c16
-rw-r--r--foot.info1
-rw-r--r--terminal.h1
3 files changed, 18 insertions, 0 deletions
diff --git a/csi.c b/csi.c
index 20c512ea..10935d85 100644
--- a/csi.c
+++ b/csi.c
@@ -324,6 +324,22 @@ csi_dispatch(struct terminal *term, uint8_t final)
switch (term->vt.private[0]) {
case 0: {
switch (final) {
+ case 'b':
+ if (term->vt.last_printed != 0) {
+ /*
+ * Note: we never reset 'last-printed'. According to
+ * ECMA-48, the behaviour is undefined if REP was
+ * _not_ preceeded by a graphical character.
+ */
+ int count = vt_param_get(term, 0, 1);
+ LOG_DBG("REP: '%C' %d times", term->vt.last_printed, count);
+
+ const int width = wcwidth(term->vt.last_printed);
+ for (int i = 0; i < count; i++)
+ term_print(term, term->vt.last_printed, width);
+ }
+ break;
+
case 'c': {
/* Send Device Attributes (Primary DA) */
diff --git a/foot.info b/foot.info
index 3e74caf2..b86aeda7 100644
--- a/foot.info
+++ b/foot.info
@@ -211,6 +211,7 @@ foot+base|foot base fragment,
kri=\E[1;2A,
op=\E[39;49m,
rc=\E8,
+ rep=%p1%c\E[%p2%{1}%-%db,
rev=\E[7m,
ri=\EM,
rin=\E[%p1%dT,
diff --git a/terminal.h b/terminal.h
index 7494efba..9f622930 100644
--- a/terminal.h
+++ b/terminal.h
@@ -110,6 +110,7 @@ struct vt_param {
struct vt {
int state; /* enum state */
+ wchar_t last_printed;
struct {
struct vt_param v[16];
size_t idx;