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 From da13ef12463d1870caed94584db464d68c6b3182 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Wed, 8 May 2019 15:29:33 -0400 Subject: external pipe eternal --- st.c | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) (limited to 'st.c') diff --git a/st.c b/st.c index bcb3444..21c6739 100644 --- a/st.c +++ b/st.c @@ -48,6 +48,8 @@ term.scr + HISTSIZE + 1) % HISTSIZE] : \ term.line[(y) - term.scr]) +#define TLINE_HIST(y) ((y) <= HISTSIZE-term.row+2 ? term.hist[(y)] : term.line[(y-HISTSIZE+term.row-3)]) + /* constants */ #define ISO14755CMD "dmenu -w \"$WINDOWID\" -p codepoint: 0 && TLINE_HIST(y)[i - 1].u == ' ') + --i; + + return i; +} + void selstart(int col, int row, int snap) { @@ -2059,16 +2075,19 @@ externalpipe(const Arg *arg) /* ignore sigpipe for now, in case child exists early */ oldsigpipe = signal(SIGPIPE, SIG_IGN); newline = 0; - for (n = 0; n < term.row; n++) { - bp = term.line[n]; - lastpos = MIN(tlinelen(n) + 1, term.col) - 1; + /* modify externalpipe patch to pipe history too */ + for (n = 0; n <= HISTSIZE + 2; n++) { + bp = TLINE_HIST(n); + lastpos = MIN(tlinehistlen(n) +1, term.col) - 1; if (lastpos < 0) break; + if (lastpos == 0) + continue; end = &bp[lastpos + 1]; for (; bp < end; ++bp) if (xwrite(to[1], buf, utf8encode(bp->u, buf)) < 0) break; - if ((newline = term.line[n][lastpos].mode & ATTR_WRAP)) + if ((newline = TLINE_HIST(n)[lastpos].mode & ATTR_WRAP)) continue; if (xwrite(to[1], "\n", 1) < 0) break; -- cgit v1.2.3