X-Git-Url: https://git.danieliu.xyz/?a=blobdiff_plain;f=st.c;h=2d901ab66e2436c95906d5edeb77ee05e7ae5058;hb=0f8b40652bca0670f1f0bda069bbc55f8b5e364d;hp=0d35613e04222564ab5fee489df6e1812b0a027f;hpb=045a0fab4f80b57f4a982ae6bc5f33fe21d66111;p=st.git diff --git a/st.c b/st.c index 0d35613..2d901ab 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 */ @@ -842,7 +843,6 @@ ttyread(void) if (buflen > 0) memmove(buf, buf + written, buflen); return ret; - } } @@ -1648,6 +1648,12 @@ csihandle(void) if (csiescseq.arg[0] == 0) ttywrite(vtiden, strlen(vtiden), 0); break; + case 'b': /* REP -- if last char is printable print it more times */ + DEFAULT(csiescseq.arg[0], 1); + if (term.lastc) + while (csiescseq.arg[0]-- > 0) + tputc(term.lastc); + break; case 'C': /* CUF -- Cursor Forward */ case 'a': /* HPR -- Cursor Forward */ DEFAULT(csiescseq.arg[0], 1); @@ -1771,7 +1777,7 @@ csihandle(void) break; case 'n': /* DSR – Device Status Report (cursor position) */ if (csiescseq.arg[0] == 6) { - len = snprintf(buf, sizeof(buf),"\033[%i;%iR", + len = snprintf(buf, sizeof(buf), "\033[%i;%iR", term.c.y+1, term.c.x+1); ttywrite(buf, len, 0); } @@ -2373,6 +2379,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 +2430,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;