From 3cd91894ec91a0de7aa71d62949ba3381e600afd Mon Sep 17 00:00:00 2001 From: yusufaktepe Date: Wed, 8 May 2019 04:05:57 +0300 Subject: Updated st to 0.8.2 Updated to latest git (20190414.f1546cf) & updated patches. Changes: . Upstream fixes. . Alpha: Opacity value is now typed in float (0-1). Also "-A" cmd option added as alternative opacity changing method. . Clipboard: middle click pastes from clipboard. . Organized shortcuts. --- st.c | 81 ++++++++++++++++++++++++++++++++------------------------------------ 1 file changed, 38 insertions(+), 43 deletions(-) (limited to 'st.c') diff --git a/st.c b/st.c index 9fd04bd..bcb3444 100644 --- a/st.c +++ b/st.c @@ -35,6 +35,7 @@ #define ESC_ARG_SIZ 16 #define STR_BUF_SIZ ESC_BUF_SIZ #define STR_ARG_SIZ ESC_ARG_SIZ +#define HISTSIZE 2000 /* macros */ #define IS_SET(flag) ((term.mode & (flag)) != 0) @@ -42,7 +43,10 @@ #define ISCONTROLC0(c) (BETWEEN(c, 0, 0x1f) || (c) == '\177') #define ISCONTROLC1(c) (BETWEEN(c, 0x80, 0x9f)) #define ISCONTROL(c) (ISCONTROLC0(c) || ISCONTROLC1(c)) -#define ISDELIM(u) (utf8strchr(worddelimiters, u) != NULL) +#define ISDELIM(u) (u && wcschr(worddelimiters, u)) +#define TLINE(y) ((y) < term.scr ? term.hist[((y) + term.histi - \ + term.scr + HISTSIZE + 1) % HISTSIZE] : \ + term.line[(y) - term.scr]) /* constants */ #define ISO14755CMD "dmenu -w \"$WINDOWID\" -p codepoint: 0) memmove(buf, buf + written, buflen); - if (term.scr > 0 && term.scr < HISTSIZE-1) - term.scr++; - return ret; } @@ -1096,7 +1088,6 @@ kscrollup(const Arg* a) } } - void tscrolldown(int orig, int n, int copyhist) { @@ -1139,6 +1130,9 @@ tscrollup(int orig, int n, int copyhist) term.line[orig] = temp; } + if (term.scr > 0 && term.scr < HISTSIZE) + term.scr = MIN(term.scr + n, HISTSIZE-1); + tclearregion(0, orig, term.col-1, orig+n-1); tsetdirt(orig+n, term.bot); @@ -1627,6 +1621,7 @@ tsetmode(int priv, int set, int *args, int narg) case 1015: /* urxvt mangled mouse mode; incompatible and can be mistaken for other control codes. */ + break; default: fprintf(stderr, "erresc: unknown private set/reset mode %d\n", @@ -1898,7 +1893,7 @@ csireset(void) void strhandle(void) { - char *p = NULL; + char *p = NULL, *dec; int j, narg, par; term.esc &= ~(ESC_STR_END|ESC_STR); @@ -1916,8 +1911,6 @@ strhandle(void) return; case 52: if (narg > 2) { - char *dec; - dec = base64dec(strescseq.args[2]); if (dec) { xsetsel(dec); @@ -1935,7 +1928,10 @@ strhandle(void) case 104: /* color reset, here p = NULL */ j = (narg > 1) ? atoi(strescseq.args[1]) : -1; if (xsetcolorname(j, p)) { - fprintf(stderr, "erresc: invalid color %s\n", p); + if (par == 104 && narg <= 1) + return; /* color reset without parameter */ + fprintf(stderr, "erresc: invalid color j=%d, p=%s\n", + j, p ? p : "(null)"); } else { /* * TODO if defaultbg color is changed, borders @@ -2462,7 +2458,6 @@ tputc(Rune u) goto check_control_code; } - if (IS_SET(MODE_SIXEL)) { /* TODO: implement sixel mode */ return; @@ -2647,7 +2642,7 @@ tresize(int col, int row) } } - /* resize each r w to new width, zero-pad if needed */ + /* resize each row to new width, zero-pad if needed */ for (i = 0; i < minrow; i++) { term.line[i] = xrealloc(term.line[i], col * sizeof(Glyph)); term.alt[i] = xrealloc(term.alt[i], col * sizeof(Glyph)); @@ -2725,12 +2720,12 @@ draw(void) cx--; drawregion(0, 0, term.col, term.row); - if (term.scr == 0) { + if (term.scr == 0) xdrawcursor(cx, term.c.y, term.line[term.c.y][cx], term.ocx, term.ocy, term.line[term.ocy][term.ocx]); - } term.ocx = cx, term.ocy = term.c.y; xfinishdraw(); + xximspot(term.ocx, term.ocy); } void -- cgit v1.2.3