aboutsummaryrefslogtreecommitdiff
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
parentdec6b530a4fddf405c1822b2cac6e2036d3c8b75 (diff)
downloadst-patched-94b8ec002101a5e8f52a342e53431eea71aa0631.tar.bz2
st-patched-94b8ec002101a5e8f52a342e53431eea71aa0631.tar.xz
st-patched-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.
-rw-r--r--st.c10
-rw-r--r--st.info2
2 files changed, 12 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 {
129 int charset; /* current charset */ 129 int charset; /* current charset */
130 int icharset; /* selected charset for sequence */ 130 int icharset; /* selected charset for sequence */
131 int *tabs; 131 int *tabs;
132 Rune lastc; /* last printed char outside of sequence, 0 if control */
132} Term; 133} Term;
133 134
134/* CSI Escape sequence structs */ 135/* CSI Escape sequence structs */
@@ -1648,6 +1649,12 @@ csihandle(void)
1648 if (csiescseq.arg[0] == 0) 1649 if (csiescseq.arg[0] == 0)
1649 ttywrite(vtiden, strlen(vtiden), 0); 1650 ttywrite(vtiden, strlen(vtiden), 0);
1650 break; 1651 break;
1652 case 'b': /* REP -- if last char is printable print it <n> more times */
1653 DEFAULT(csiescseq.arg[0], 1);
1654 if (term.lastc)
1655 while (csiescseq.arg[0]-- > 0)
1656 tputc(term.lastc);
1657 break;
1651 case 'C': /* CUF -- Cursor <n> Forward */ 1658 case 'C': /* CUF -- Cursor <n> Forward */
1652 case 'a': /* HPR -- Cursor <n> Forward */ 1659 case 'a': /* HPR -- Cursor <n> Forward */
1653 DEFAULT(csiescseq.arg[0], 1); 1660 DEFAULT(csiescseq.arg[0], 1);
@@ -2373,6 +2380,8 @@ check_control_code:
2373 /* 2380 /*
2374 * control codes are not shown ever 2381 * control codes are not shown ever
2375 */ 2382 */
2383 if (!term.esc)
2384 term.lastc = 0;
2376 return; 2385 return;
2377 } else if (term.esc & ESC_START) { 2386 } else if (term.esc & ESC_START) {
2378 if (term.esc & ESC_CSI) { 2387 if (term.esc & ESC_CSI) {
@@ -2422,6 +2431,7 @@ check_control_code:
2422 } 2431 }
2423 2432
2424 tsetchar(u, &term.c.attr, term.c.x, term.c.y); 2433 tsetchar(u, &term.c.attr, term.c.x, term.c.y);
2434 term.lastc = u;
2425 2435
2426 if (width == 2) { 2436 if (width == 2) {
2427 gp->mode |= ATTR_WIDE; 2437 gp->mode |= ATTR_WIDE;
diff --git a/st.info b/st.info
index d0694e2..8201ad6 100644
--- a/st.info
+++ b/st.info
@@ -184,6 +184,8 @@ st-mono| simpleterm monocolor,
184# XTerm extensions 184# XTerm extensions
185 rmxx=\E[29m, 185 rmxx=\E[29m,
186 smxx=\E[9m, 186 smxx=\E[9m,
187# disabled rep for now: causes some issues with older ncurses versions.
188# rep=%p1%c\E[%p2%{1}%-%db,
187# tmux extensions, see TERMINFO EXTENSIONS in tmux(1) 189# tmux extensions, see TERMINFO EXTENSIONS in tmux(1)
188 Tc, 190 Tc,
189 Ms=\E]52;%p1%s;%p2%s\007, 191 Ms=\E]52;%p1%s;%p2%s\007,