aboutsummaryrefslogtreecommitdiff
path: root/st.c
diff options
context:
space:
mode:
authorHiltjo Posthuma <hiltjo@codemadness.org>2020-05-30 21:34:57 +0200
committerHiltjo Posthuma <hiltjo@codemadness.org>2020-05-30 22:04:28 +0200
commit94b8ec002101a5e8f52a342e53431eea71aa0631 (patch)
tree67d5e3b8753b6aefc2bce17a982a4818edd5cb41 /st.c
parentdec6b530a4fddf405c1822b2cac6e2036d3c8b75 (diff)
downloadst-94b8ec002101a5e8f52a342e53431eea71aa0631.tar.gz
st-94b8ec002101a5e8f52a342e53431eea71aa0631.tar.bz2
st-94b8ec002101a5e8f52a342e53431eea71aa0631.zip
Partially add back in "support REP (repeat) escape sequence"
Add the functionality back in for xterm compatibility, but do not expose the capability in st.info (yet). Some notes: It was reverted because it caused some issues with ncurses in some configurations, namely when using BSD padding (--enable-bsdpad, BSD_TPUTS) in ncurses it caused issues with repeating digits. A fix has been upstreamed in ncurses since snapshot 20200523. The fix is also backported to OpenBSD -current.
Diffstat (limited to 'st.c')
-rw-r--r--st.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/st.c b/st.c
index 0d35613..54af098 100644
--- a/st.c
+++ b/st.c
@@ -129,6 +129,7 @@ typedef struct {
int charset; /* current charset */
int icharset; /* selected charset for sequence */
int *tabs;
+ Rune lastc; /* last printed char outside of sequence, 0 if control */
} Term;
/* CSI Escape sequence structs */
@@ -1648,6 +1649,12 @@ csihandle(void)
if (csiescseq.arg[0] == 0)
ttywrite(vtiden, strlen(vtiden), 0);
break;
+ case 'b': /* REP -- if last char is printable print it <n> more times */
+ DEFAULT(csiescseq.arg[0], 1);
+ if (term.lastc)
+ while (csiescseq.arg[0]-- > 0)
+ tputc(term.lastc);
+ break;
case 'C': /* CUF -- Cursor <n> Forward */
case 'a': /* HPR -- Cursor <n> Forward */
DEFAULT(csiescseq.arg[0], 1);
@@ -2373,6 +2380,8 @@ check_control_code:
/*
* control codes are not shown ever
*/
+ if (!term.esc)
+ term.lastc = 0;
return;
} else if (term.esc & ESC_START) {
if (term.esc & ESC_CSI) {
@@ -2422,6 +2431,7 @@ check_control_code:
}
tsetchar(u, &term.c.attr, term.c.x, term.c.y);
+ term.lastc = u;
if (width == 2) {
gp->mode |= ATTR_WIDE;