-- - /* Purely graphic info */ - typedef struct { - Display *dpy; -_AT_@ -327,6 +309,8 @@ typedef struct { - /* function definitions used in config.h */ - static void clipcopy(const Arg *); - static void clippaste(const Arg *); -+static void kscrolldown(const Arg *); -+static void kscrollup(const Arg *); - static void numlock(const Arg *); - static void selpaste(const Arg *); - static void xzoom(const Arg *); -_AT_@ -340,6 +324,29 @@ static void sendbreak(const Arg *); - /* Config.h for applying patches and the configuration. */ - #include "config.h" - -+/* Internal representation of the screen */ -+typedef struct { -+ int row; /* nb row */ -+ int col; /* nb col */ -+ Line *line; /* screen */ -+ Line *alt; /* alternate screen */ -+ Line hist[histsize]; /* history buffer */ -+ int histi; /* history index */ -+ int scr; /* scroll back */ -+ int *dirty; /* dirtyness of lines */ -+ XftGlyphFontSpec *specbuf; /* font spec buffer used for rendering */ -+ TCursor c; /* cursor */ -+ int top; /* top scroll limit */ -+ int bot; /* bottom scroll limit */ -+ int mode; /* terminal mode flags */ -+ int esc; /* escape state flags */ -+ char trantbl[4]; /* charset table translation */ -+ int charset; /* current charset */ -+ int icharset; /* selected charset for sequence */ -+ int numlock; /* lock numbers in keyboard */ -+ int *tabs; -+} Term; -+ - /* Font structure */ - typedef struct { - int height; -_AT_@ -399,8 +406,8 @@ static void tputtab(int); - static void tputc(Rune); - static void treset(void); - static void tresize(int, int); --static void tscrollup(int, int); --static void tscrolldown(int, int); -+static void tscrollup(int, int, int); -+static void tscrolldown(int, int, int); - static void tsetattr(int *, int); - static void tsetchar(Rune, Glyph *, int, int); - static void tsetscroll(int, int); -_AT_@ -731,10 +738,10 @@ tlinelen(int y) - { - int i = term.col; - -- if (term.line[y][i - 1].mode & ATTR_WRAP) -+ if (TLINE(y)[i - 1].mode & ATTR_WRAP) - return i; - -- while (i > 0 && term.line[y][i - 1].u == ' ') -+ while (i > 0 && TLINE(y)[i - 1].u == ' ') - --i; - - return i; -_AT_@ -796,7 +803,7 @@ selsnap(int *x, int *y, int direction) - * Snap around if the word wraps around at the end or - * beginning of a line. - */ -- prevgp = &term.line[*y][*x]; -+ prevgp = &TLINE(*y)[*x]; - prevdelim = ISDELIM(prevgp->u); - for (;;) { - newx = *x + direction; -_AT_@ -811,14 +818,14 @@ selsnap(int *x, int *y, int direction) - yt = *y, xt = *x; - else - yt = newy, xt = newx; -- if (!(term.line[yt][xt].mode & ATTR_WRAP)) -+ if (!(TLINE(yt)[xt].mode & ATTR_WRAP)) - break; - } - - if (newx >= tlinelen(newy)) - break; - -- gp = &term.line[newy][newx]; -+ gp = &TLINE(newy)[newx]; - delim = ISDELIM(gp->u); - if (!(gp->mode & ATTR_WDUMMY) && (delim != prevdelim - || (delim && gp->u != prevgp->u))) -_AT_@ -839,14 +846,14 @@ selsnap(int *x, int *y, int direction) - *x = (direction < 0) ? 0 : term.col - 1; - if (direction < 0) { - for (; *y > 0; *y += direction) { -- if (!(term.line[*y-1][term.col-1].mode -+ if (!(TLINE(*y-1)[term.col-1].mode - & ATTR_WRAP)) { - break; - } - } - } else if (direction > 0) { - for (; *y < term.row-1; *y += direction) { -- if (!(term.line[*y][term.col-1].mode -+ if (!(TLINE(*y)[term.col-1].mode - & ATTR_WRAP)) { - break; - } -_AT_@ -1012,13 +1019,13 @@ getsel(void) - } - - if (sel.type == SEL_RECTANGULAR) { -- gp = &term.line[y][sel.nb.x]; -+ gp = &TLINE(y)[sel.nb.x]; - lastx = sel.ne.x; - } else { -- gp = &term.line[y][sel.nb.y == y ? sel.nb.x : 0]; -+ gp = &TLINE(y)[sel.nb.y == y ? sel.nb.x : 0]; - lastx = (sel.ne.y == y) ? sel.ne.x : term.col-1; - } -- last = &term.line[y][MIN(lastx, linelen-1)]; -+ last = &TLINE(y)[MIN(lastx, linelen-1)]; - while (last >= gp && last->u == ' ') - --last; - -_AT_@ -1490,6 +1497,9 @@ ttyread(void) - /* keep any uncomplete utf8 char for the next call */ - memmove(buf, ptr, buflen); - -+ if (term.scr > 0 && term.scr < histsize-1) -+ term.scr++; -+ - return ret; - } - -_AT_@ -1499,6 +1509,9 @@ ttywrite(const char *s, size_t n) - fd_set wfd, rfd; - ssize_t r; - size_t lim = 256; -+ Arg arg = (Arg){ .i = term.scr }; -+ -+ kscrolldown(&arg); - - /* - * Remember that we are using a pty, which might be a modem line. -_AT_@ -1690,13 +1703,53 @@ tswapscreen(void) - } - - void --tscrolldown(int orig, int n) -+kscrolldown(const Arg* a) -+{ -+ int n = a->i; -+ -+ if (n < 0) -+ n = term.row + n; -+ -+ if (n > term.scr) -+ n = term.scr; -+ -+ if (term.scr > 0) { -+ term.scr -= n; -+ selscroll(0, -n); -+ tfulldirt(); -+ } -+} -+ -+void -+kscrollup(const Arg* a) -+{ -+ int n = a->i; -+ -+ if (n < 0) -+ n = term.row + n; -+ -+ if (term.scr <= histsize - n) { -+ term.scr += n; -+ selscroll(0, n); -+ tfulldirt(); -+ } -+} -+ -+void -+tscrolldown(int orig, int n, int copyhist) - { - int i; - Line temp; - - LIMIT(n, 0, term.bot-orig+1); - -+ if (copyhist) { -+ term.histi = (term.histi - 1 + histsize) % histsize; -+ temp = term.hist[term.histi]; -+ term.hist[term.histi] = term.line[term.bot]; -+ term.line[term.bot] = temp; -+ } -+ - tsetdirt(orig, term.bot-n); - tclearregion(0, term.bot-n+1, term.col-1, term.bot); - -_AT_@ -1710,13 +1763,20 @@ tscrolldown(int orig, int n) - } - - void --tscrollup(int orig, int n) -+tscrollup(int orig, int n, int copyhist) - { - int i; - Line temp; - - LIMIT(n, 0, term.bot-orig+1); - -+ if (copyhist) { -+ term.histi = (term.histi + 1) % histsize; -+ temp = term.hist[term.histi]; -+ term.hist[term.histi] = term.line[orig]; -+ term.line[orig] = temp; -+ } -+ - tclearregion(0, orig, term.col-1, orig+n-1); - tsetdirt(orig+n, term.bot); - -_AT_@ -1765,7 +1825,7 @@ tnewline(int first_col) - int y = term.c.y; - - if (y == term.bot) { -- tscrollup(term.top, 1); -+ tscrollup(term.top, 1, 1); - } else { - y++; - } -_AT_@ -1930,14 +1990,14 @@ void - tinsertblankline(int n) - { - if (BETWEEN(term.c.y, term.top, term.bot)) -- tscrolldown(term.c.y, n); -+ tscrolldown(term.c.y, n, 0); - } - - void - tdeleteline(int n) - { - if (BETWEEN(term.c.y, term.top, term.bot)) -- tscrollup(term.c.y, n); -+ tscrollup(term.c.y, n, 0); - } - - int32_t -_AT_@ -2371,11 +2431,11 @@ csihandle(void) - break; - case 'S': /* SU -- Scroll <n> line up */ - DEFAULT(csiescseq.arg[0], 1); -- tscrollup(term.top, csiescseq.arg[0]); -+ tscrollup(term.top, csiescseq.arg[0], 0); - break; - case 'T': /* SD -- Scroll <n> line down */ - DEFAULT(csiescseq.arg[0], 1); -- tscrolldown(term.top, csiescseq.arg[0]); -+ tscrolldown(term.top, csiescseq.arg[0], 0); - break; - case 'L': /* IL -- Insert <n> blank lines */ - DEFAULT(csiescseq.arg[0], 1); -_AT_@ -2871,7 +2931,7 @@ eschandle(uchar ascii) - return 0; - case 'D': /* IND -- Linefeed */ - if (term.c.y == term.bot) { -- tscrollup(term.top, 1); -+ tscrollup(term.top, 1, 1); - } else { - tmoveto(term.c.x, term.c.y+1); - } -_AT_@ -2884,7 +2944,7 @@ eschandle(uchar ascii) - break; - case 'M': /* RI -- Reverse index */ - if (term.c.y == term.top) { -- tscrolldown(term.top, 1); -+ tscrolldown(term.top, 1, 1); - } else { - tmoveto(term.c.x, term.c.y-1); - } -_AT_@ -3047,7 +3107,7 @@ tputc(Rune u) - void - tresize(int col, int row) - { -- int i; -+ int i, j; - int minrow = MIN(row, term.row); - int mincol = MIN(col, term.col); - int *bp; -_AT_@ -3087,6 +3147,14 @@ tresize(int col, int row) - term.dirty = xrealloc(term.dirty, row * sizeof(*term.dirty)); - term.tabs = xrealloc(term.tabs, col * sizeof(*term.tabs)); - -+ for (i = 0; i < histsize; i++) { -+ term.hist[i] = xrealloc(term.hist[i], col * sizeof(Glyph)); -+ for (j = mincol; j < col; j++) { -+ term.hist[i][j] = term.c.attr; -+ term.hist[i][j].u = ' '; -+ } -+ } -+ - /* 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)); -_AT_@ -3976,11 +4044,11 @@ drawregion(int x1, int y1, int x2, int y2) - term.dirty[y] = 0; - - specs = term.specbuf; -- numspecs = xmakeglyphfontspecs(specs, &term.line[y][x1], x2 - x1, x1, y); -+ numspecs = xmakeglyphfontspecs(specs, &TLINE(y)[x1], x2 - x1, x1, y); - - i = ox = 0; - for (x = x1; x < x2 && i < numspecs; x++) { -- new = term.line[y][x]; -+ new = TLINE(y)[x]; - if (new.mode == ATTR_WDUMMY) - continue; - if (ena_sel && selected(x, y)) -_AT_@ -4000,7 +4068,8 @@ drawregion(int x1, int y1, int x2, int y2) - if (i > 0) - xdrawglyphfontspecs(specs, base, i, ox, y); - } -- xdrawcursor(); -+ if (term.scr == 0) -+ xdrawcursor(); - } - - void diff --git a/st.suckless.org/patches/scrollback/st-scrollback-0.8.1.diff b/st.suckless.org/patches/scrollback/st-scrollback-0.8.1.diff deleted file mode 100644 index face2d9b..00000000 --- a/st.suckless.org/patches/scrollback/st-scrollback-0.8.1.diff +++ /dev/null _AT_@ -1,349 +0,0 @@ -From f2d5975051daf2b4496a0b0193381e0d6c55a80b Mon Sep 17 00:00:00 2001 -From: Jordan Cran <jordan_AT_instantepiphany.com.au> -Date: Sun, 17 Feb 2019 11:57:35 +1100 -Subject: [PATCH] Add scrollback (4000 line history default) for 0.8.1 - ---- - config.def.h | 2 + - st.c | 119 ++++++++++++++++++++++++++++++++++++++++----------- - st.h | 2 + - 3 files changed, 98 insertions(+), 25 deletions(-) - -diff --git a/config.def.h b/config.def.h -index 82b1b09..27d42ca 100644 ---- a/config.def.h -+++ b/config.def.h -_AT_@ -178,6 +178,8 @@ static Shortcut shortcuts[] = { - { TERMMOD, XK_Y, selpaste, {.i = 0} }, - { TERMMOD, XK_Num_Lock, numlock, {.i = 0} }, - { TERMMOD, XK_I, iso14755, {.i = 0} }, -+ { ShiftMask, XK_Page_Up, kscrollup, {.i = -1} }, -+ { ShiftMask, XK_Page_Down, kscrolldown, {.i = -1} }, - }; - - /* -diff --git a/st.c b/st.c -index 46c954b..a6a0ba0 100644 ---- a/st.c -+++ b/st.c -_AT_@ -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) -_AT_@ -43,6 +44,9 @@ - #define ISCONTROLC1(c) (BETWEEN(c, 0x80, 0x9f)) - #define ISCONTROL(c) (ISCONTROLC0(c) || ISCONTROLC1(c)) - #define ISDELIM(u) (utf8strchr(worddelimiters, u) != NULL) -+#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: </dev/null" -_AT_@ -121,6 +125,9 @@ typedef struct { - int col; /* nb col */ - Line *line; /* screen */ - Line *alt; /* alternate screen */ -+ Line hist[HISTSIZE]; /* history buffer */ -+ int histi; /* history index */ -+ int scr; /* scroll back */ - int *dirty; /* dirtyness of lines */ - TCursor c; /* cursor */ - int ocx; /* old cursor col */ -_AT_@ -188,8 +195,8 @@ static void tnewline(int); - static void tputtab(int); - static void tputc(Rune); - static void treset(void); --static void tscrollup(int, int); --static void tscrolldown(int, int); -+static void tscrollup(int, int, int); -+static void tscrolldown(int, int, int); - static void tsetattr(int *, int); - static void tsetchar(Rune, Glyph *, int, int); - static void tsetdirt(int, int); -_AT_@ -431,10 +438,10 @@ tlinelen(int y) - { - int i = term.col; - -- if (term.line[y][i - 1].mode & ATTR_WRAP) -+ if (TLINE(y)[i - 1].mode & ATTR_WRAP) - return i; - -- while (i > 0 && term.line[y][i - 1].u == ' ') -+ while (i > 0 && TLINE(y)[i - 1].u == ' ') - --i; - - return i; -_AT_@ -543,7 +550,7 @@ selsnap(int *x, int *y, int direction) - * Snap around if the word wraps around at the end or - * beginning of a line. - */ -- prevgp = &term.line[*y][*x]; -+ prevgp = &TLINE(*y)[*x]; - prevdelim = ISDELIM(prevgp->u); - for (;;) { - newx = *x + direction; -_AT_@ -558,14 +565,14 @@ selsnap(int *x, int *y, int direction) - yt = *y, xt = *x; - else - yt = newy, xt = newx; -- if (!(term.line[yt][xt].mode & ATTR_WRAP)) -+ if (!(TLINE(yt)[xt].mode & ATTR_WRAP)) - break; - } - - if (newx >= tlinelen(newy)) - break; - -- gp = &term.line[newy][newx]; -+ gp = &TLINE(newy)[newx]; - delim = ISDELIM(gp->u); - if (!(gp->mode & ATTR_WDUMMY) && (delim != prevdelim - || (delim && gp->u != prevgp->u))) -_AT_@ -586,14 +593,14 @@ selsnap(int *x, int *y, int direction) - *x = (direction < 0) ? 0 : term.col - 1; - if (direction < 0) { - for (; *y > 0; *y += direction) { -- if (!(term.line[*y-1][term.col-1].mode -+ if (!(TLINE(*y-1)[term.col-1].mode - & ATTR_WRAP)) { - break; - } - } - } else if (direction > 0) { - for (; *y < term.row-1; *y += direction) { -- if (!(term.line[*y][term.col-1].mode -+ if (!(TLINE(*y)[term.col-1].mode - & ATTR_WRAP)) { - break; - } -_AT_@ -624,13 +631,13 @@ getsel(void) - } - - if (sel.type == SEL_RECTANGULAR) { -- gp = &term.line[y][sel.nb.x]; -+ gp = &TLINE(y)[sel.nb.x]; - lastx = sel.ne.x; - } else { -- gp = &term.line[y][sel.nb.y == y ? sel.nb.x : 0]; -+ gp = &TLINE(y)[sel.nb.y == y ? sel.nb.x : 0]; - lastx = (sel.ne.y == y) ? sel.ne.x : term.col-1; - } -- last = &term.line[y][MIN(lastx, linelen-1)]; -+ last = &TLINE(y)[MIN(lastx, linelen-1)]; - while (last >= gp && last->u == ' ') - --last; - -_AT_@ -842,6 +849,9 @@ void - ttywrite(const char *s, size_t n, int may_echo) - { - const char *next; -+ Arg arg = (Arg) { .i = term.scr }; -+ -+ kscrolldown(&arg); - - if (may_echo && IS_SET(MODE_ECHO)) - twrite(s, n, 1); -_AT_@ -1053,13 +1063,53 @@ tswapscreen(void) - } - - void --tscrolldown(int orig, int n) -+kscrolldown(const Arg* a) -+{ -+ int n = a->i; -+ -+ if (n < 0) -+ n = term.row + n; -+ -+ if (n > term.scr) -+ n = term.scr; -+ -+ if (term.scr > 0) { -+ term.scr -= n; -+ selscroll(0, -n); -+ tfulldirt(); -+ } -+} -+ -+void -+kscrollup(const Arg* a) -+{ -+ int n = a->i; -+ -+ if (n < 0) -+ n = term.row + n; -+ -+ if (term.scr <= HISTSIZE-n) { -+ term.scr += n; -+ selscroll(0, n); -+ tfulldirt(); -+ } -+} -+ -+void -+tscrolldown(int orig, int n, int copyhist) - { - int i; - Line temp; - - LIMIT(n, 0, term.bot-orig+1); - -+ if (copyhist) { -+ term.histi = (term.histi - 1 + HISTSIZE) % HISTSIZE; -+ temp = term.hist[term.histi]; -+ term.hist[term.histi] = term.line[term.bot]; -+ term.line[term.bot] = temp; -+ } -+ - tsetdirt(orig, term.bot-n); - tclearregion(0, term.bot-n+1, term.col-1, term.bot); - -_AT_@ -1073,13 +1123,23 @@ tscrolldown(int orig, int n) - } - - void --tscrollup(int orig, int n) -+tscrollup(int orig, int n, int copyhist) - { - int i; - Line temp; - - LIMIT(n, 0, term.bot-orig+1); - -+ if (copyhist) { -+ term.histi = (term.histi + 1) % HISTSIZE; -+ temp = term.hist[term.histi]; -+ term.hist[term.histi] = term.line[orig]; -+ 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); - -_AT_@ -1128,7 +1188,7 @@ tnewline(int first_col) - int y = term.c.y; - - if (y == term.bot) { -- tscrollup(term.top, 1); -+ tscrollup(term.top, 1, 1); - } else { - y++; - } -_AT_@ -1293,14 +1353,14 @@ void - tinsertblankline(int n) - { - if (BETWEEN(term.c.y, term.top, term.bot)) -- tscrolldown(term.c.y, n); -+ tscrolldown(term.c.y, n, 0); - } - - void - tdeleteline(int n) - { - if (BETWEEN(term.c.y, term.top, term.bot)) -- tscrollup(term.c.y, n); -+ tscrollup(term.c.y, n, 0); - } - - int32_t -_AT_@ -1729,11 +1789,11 @@ csihandle(void) - break; - case 'S': /* SU -- Scroll <n> line up */ - DEFAULT(csiescseq.arg[0], 1); -- tscrollup(term.top, csiescseq.arg[0]); -+ tscrollup(term.top, csiescseq.arg[0], 0); - break; - case 'T': /* SD -- Scroll <n> line down */ - DEFAULT(csiescseq.arg[0], 1); -- tscrolldown(term.top, csiescseq.arg[0]); -+ tscrolldown(term.top, csiescseq.arg[0], 0); - break; - case 'L': /* IL -- Insert <n> blank lines */ - DEFAULT(csiescseq.arg[0], 1); -_AT_@ -2257,7 +2317,7 @@ eschandle(uchar ascii) - return 0; - case 'D': /* IND -- Linefeed */ - if (term.c.y == term.bot) { -- tscrollup(term.top, 1); -+ tscrollup(term.top, 1, 1); - } else { - tmoveto(term.c.x, term.c.y+1); - } -_AT_@ -2270,7 +2330,7 @@ eschandle(uchar ascii) - break; - case 'M': /* RI -- Reverse index */ - if (term.c.y == term.top) { -- tscrolldown(term.top, 1); -+ tscrolldown(term.top, 1, 1); - } else { - tmoveto(term.c.x, term.c.y-1); - } -_AT_@ -2489,7 +2549,7 @@ twrite(const char *buf, int buflen, int show_ctrl) - void - tresize(int col, int row) - { -- int i; -+ int i, j; - int minrow = MIN(row, term.row); - int mincol = MIN(col, term.col); - int *bp; -_AT_@ -2526,6 +2586,14 @@ tresize(int col, int row) - term.dirty = xrealloc(term.dirty, row * sizeof(*term.dirty)); - term.tabs = xrealloc(term.tabs, col * sizeof(*term.tabs)); - -+ for (i = 0; i < HISTSIZE; i++) { -+ term.hist[i] = xrealloc(term.hist[i], col * sizeof(Glyph)); -+ for (j = mincol; j < col; j++) { -+ term.hist[i][j] = term.c.attr; -+ term.hist[i][j].u = ' '; -+ } -+ } -+ - /* 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)); -_AT_@ -2583,7 +2651,7 @@ drawregion(int x1, int y1, int x2, int y2) - continue; - - term.dirty[y] = 0; -- xdrawline(term.line[y], x1, y, x2); -+ xdrawline(TLINE(y), x1, y, x2); - } - } - -_AT_@ -2604,8 +2672,9 @@ draw(void) - cx--; - - drawregion(0, 0, term.col, term.row); -- xdrawcursor(cx, term.c.y, term.line[term.c.y][cx], -- term.ocx, term.ocy, term.line[term.ocy][term.ocx]); -+ 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(); - } -diff --git a/st.h b/st.h -index dac64d8..d47e5fd 100644 ---- a/st.h -+++ b/st.h -_AT_@ -80,6 +80,8 @@ void die(const char *, ...); - void redraw(void); - void draw(void); - -+void kscrolldown(const Arg *); -+void kscrollup(const Arg *); - void iso14755(const Arg *); - void printscreen(const Arg *); - void printsel(const Arg *); --- -2.18.1 - diff --git a/st.suckless.org/patches/scrollback/st-scrollback-20200419-72e3f6c.diff b/st.suckless.org/patches/scrollback/st-scrollback-0.8.4.diff similarity index 88% rename from st.suckless.org/patches/scrollback/st-scrollback-20200419-72e3f6c.diff rename to st.suckless.org/patches/scrollback/st-scrollback-0.8.4.diff index e72999c1..88e0c794 100644 --- a/st.suckless.org/patches/scrollback/st-scrollback-20200419-72e3f6c.diff +++ b/st.suckless.org/patches/scrollback/st-scrollback-0.8.4.diff _AT_@ -1,8 +1,8 @@ diff --git a/config.def.h b/config.def.h -index 0895a1f..eef24df 100644 +index 6f05dce..93cbcc0 100644 --- a/config.def.h +++ b/config.def.h -_AT_@ -188,6 +188,8 @@ static Shortcut shortcuts[] = { +_AT_@ -199,6 +199,8 @@ static Shortcut shortcuts[] = { { TERMMOD, XK_Y, selpaste, {.i = 0} }, { ShiftMask, XK_Insert, selpaste, {.i = 0} }, { TERMMOD, XK_Num_Lock, numlock, {.i = 0} }, _AT_@ -12,7 +12,7 @@ index 0895a1f..eef24df 100644 /* diff --git a/st.c b/st.c -index 0ce6ac2..641edc0 100644 +index 76b7e0d..edec064 100644 --- a/st.c +++ b/st.c _AT_@ -35,6 +35,7 @@ _AT_@ -33,7 +33,7 @@ index 0ce6ac2..641edc0 100644 enum term_mode { MODE_WRAP = 1 << 0, -_AT_@ -117,6 +121,9 @@ typedef struct { +_AT_@ -115,6 +119,9 @@ typedef struct { int col; /* nb col */ Line *line; /* screen */ Line *alt; /* alternate screen */ _AT_@ -43,7 +43,7 @@ index 0ce6ac2..641edc0 100644 int *dirty; /* dirtyness of lines */ TCursor c; /* cursor */ int ocx; /* old cursor col */ -_AT_@ -185,8 +192,8 @@ static void tnewline(int); +_AT_@ -184,8 +191,8 @@ static void tnewline(int); static void tputtab(int); static void tputc(Rune); static void treset(void); _AT_@ -54,7 +54,7 @@ index 0ce6ac2..641edc0 100644 static void tsetattr(int *, int); static void tsetchar(Rune, Glyph *, int, int); static void tsetdirt(int, int); -_AT_@ -415,10 +422,10 @@ tlinelen(int y) +_AT_@ -414,10 +421,10 @@ tlinelen(int y) { int i = term.col; _AT_@ -67,7 +67,7 @@ index 0ce6ac2..641edc0 100644 --i; return i; -_AT_@ -527,7 +534,7 @@ selsnap(int *x, int *y, int direction) +_AT_@ -526,7 +533,7 @@ selsnap(int *x, int *y, int direction) * Snap around if the word wraps around at the end or * beginning of a line. */ _AT_@ -76,7 +76,7 @@ index 0ce6ac2..641edc0 100644 prevdelim = ISDELIM(prevgp->u); for (;;) { newx = *x + direction; -_AT_@ -542,14 +549,14 @@ selsnap(int *x, int *y, int direction) +_AT_@ -541,14 +548,14 @@ selsnap(int *x, int *y, int direction) yt = *y, xt = *x; else yt = newy, xt = newx; _AT_@ -93,7 +93,7 @@ index 0ce6ac2..641edc0 100644 delim = ISDELIM(gp->u); if (!(gp->mode & ATTR_WDUMMY) && (delim != prevdelim || (delim && gp->u != prevgp->u))) -_AT_@ -570,14 +577,14 @@ selsnap(int *x, int *y, int direction) +_AT_@ -569,14 +576,14 @@ selsnap(int *x, int *y, int direction) *x = (direction < 0) ? 0 : term.col - 1; if (direction < 0) { for (; *y > 0; *y += direction) { _AT_@ -110,7 +110,7 @@ index 0ce6ac2..641edc0 100644 & ATTR_WRAP)) { break; } -_AT_@ -608,13 +615,13 @@ getsel(void) +_AT_@ -607,13 +614,13 @@ getsel(void) } if (sel.type == SEL_RECTANGULAR) { _AT_@ -127,7 +127,7 @@ index 0ce6ac2..641edc0 100644 while (last >= gp && last->u == ' ') --last; -_AT_@ -849,6 +856,9 @@ void +_AT_@ -848,6 +855,9 @@ void ttywrite(const char *s, size_t n, int may_echo) { const char *next; _AT_@ -137,7 +137,7 @@ index 0ce6ac2..641edc0 100644 if (may_echo && IS_SET(MODE_ECHO)) twrite(s, n, 1); -_AT_@ -1060,13 +1070,53 @@ tswapscreen(void) +_AT_@ -1059,13 +1069,53 @@ tswapscreen(void) } void _AT_@ -192,7 +192,7 @@ index 0ce6ac2..641edc0 100644 tsetdirt(orig, term.bot-n); tclearregion(0, term.bot-n+1, term.col-1, term.bot); -_AT_@ -1076,17 +1126,28 @@ tscrolldown(int orig, int n) +_AT_@ -1075,17 +1125,28 @@ tscrolldown(int orig, int n) term.line[i-n] = temp; } _AT_@ -223,7 +223,7 @@ index 0ce6ac2..641edc0 100644 tclearregion(0, orig, term.col-1, orig+n-1); tsetdirt(orig+n, term.bot); -_AT_@ -1096,7 +1157,8 @@ tscrollup(int orig, int n) +_AT_@ -1095,7 +1156,8 @@ tscrollup(int orig, int n) term.line[i+n] = temp; } _AT_@ -233,7 +233,7 @@ index 0ce6ac2..641edc0 100644 } void -_AT_@ -1135,7 +1197,7 @@ tnewline(int first_col) +_AT_@ -1124,7 +1186,7 @@ tnewline(int first_col) int y = term.c.y; if (y == term.bot) { _AT_@ -242,7 +242,7 @@ index 0ce6ac2..641edc0 100644 } else { y++; } -_AT_@ -1300,14 +1362,14 @@ void +_AT_@ -1289,14 +1351,14 @@ void tinsertblankline(int n) { if (BETWEEN(term.c.y, term.top, term.bot)) _AT_@ -259,7 +259,7 @@ index 0ce6ac2..641edc0 100644 } int32_t -_AT_@ -1738,11 +1800,11 @@ csihandle(void) +_AT_@ -1733,11 +1795,11 @@ csihandle(void) break; case 'S': /* SU -- Scroll <n> line up */ DEFAULT(csiescseq.arg[0], 1); _AT_@ -273,7 +273,7 @@ index 0ce6ac2..641edc0 100644 break; case 'L': /* IL -- Insert <n> blank lines */ DEFAULT(csiescseq.arg[0], 1); -_AT_@ -2248,7 +2310,7 @@ eschandle(uchar ascii) +_AT_@ -2241,7 +2303,7 @@ eschandle(uchar ascii) return 0; case 'D': /* IND -- Linefeed */ if (term.c.y == term.bot) { _AT_@ -282,7 +282,7 @@ index 0ce6ac2..641edc0 100644 } else { tmoveto(term.c.x, term.c.y+1); } -_AT_@ -2261,7 +2323,7 @@ eschandle(uchar ascii) +_AT_@ -2254,7 +2316,7 @@ eschandle(uchar ascii) break; case 'M': /* RI -- Reverse index */ if (term.c.y == term.top) { _AT_@ -291,7 +291,7 @@ index 0ce6ac2..641edc0 100644 } else { tmoveto(term.c.x, term.c.y-1); } -_AT_@ -2482,7 +2544,7 @@ twrite(const char *buf, int buflen, int show_ctrl) +_AT_@ -2464,7 +2526,7 @@ twrite(const char *buf, int buflen, int show_ctrl) void tresize(int col, int row) { _AT_@ -300,7 +300,7 @@ index 0ce6ac2..641edc0 100644 int minrow = MIN(row, term.row); int mincol = MIN(col, term.col); int *bp; -_AT_@ -2519,6 +2581,14 @@ tresize(int col, int row) +_AT_@ -2501,6 +2563,14 @@ tresize(int col, int row) term.dirty = xrealloc(term.dirty, row * sizeof(*term.dirty)); term.tabs = xrealloc(term.tabs, col * sizeof(*term.tabs)); _AT_@ -315,7 +315,7 @@ index 0ce6ac2..641edc0 100644 /* 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)); -_AT_@ -2577,7 +2647,7 @@ drawregion(int x1, int y1, int x2, int y2) +_AT_@ -2559,7 +2629,7 @@ drawregion(int x1, int y1, int x2, int y2) continue; term.dirty[y] = 0; _AT_@ -324,7 +324,7 @@ index 0ce6ac2..641edc0 100644 } } -_AT_@ -2598,8 +2668,9 @@ draw(void) +_AT_@ -2580,8 +2650,9 @@ draw(void) cx--; drawregion(0, 0, term.col, term.row); _AT_@ -337,7 +337,7 @@ index 0ce6ac2..641edc0 100644 term.ocy = term.c.y; xfinishdraw(); diff --git a/st.h b/st.h -index d978458..b9a4eeb 100644 +index 3d351b6..f44e1d3 100644 --- a/st.h +++ b/st.h _AT_@ -81,6 +81,8 @@ void die(const char *, ...); diff --git a/st.suckless.org/patches/scrollback/st-scrollback-0.8.diff b/st.suckless.org/patches/scrollback/st-scrollback-0.8.diff deleted file mode 100644 index bd71589b..00000000 --- a/st.suckless.org/patches/scrollback/st-scrollback-0.8.diff +++ /dev/null _AT_@ -1,348 +0,0 @@ -diff --git a/config.def.h b/config.def.h -index 82b1b09..27d42ca 100644 ---- a/config.def.h -+++ b/config.def.h -_AT_@ -178,6 +178,8 @@ static Shortcut shortcuts[] = { - { TERMMOD, XK_Y, selpaste, {.i = 0} }, - { TERMMOD, XK_Num_Lock, numlock, {.i = 0} }, - { TERMMOD, XK_I, iso14755, {.i = 0} }, -+ { ShiftMask, XK_Page_Up, kscrollup, {.i = -1} }, -+ { ShiftMask, XK_Page_Down, kscrolldown, {.i = -1} }, - }; - - /* -diff --git a/st.c b/st.c -index 65a0cb6..1d8c12a 100644 ---- a/st.c -+++ b/st.c -_AT_@ -121,6 +121,9 @@ typedef struct { - int col; /* nb col */ - Line *line; /* screen */ - Line *alt; /* alternate screen */ -+ Line hist[HISTSIZE]; /* history buffer */ -+ int histi; /* history index */ -+ int scr; /* scroll back */ - int *dirty; /* dirtyness of lines */ - TCursor c; /* cursor */ - int ocx; /* old cursor col */ -_AT_@ -188,8 +191,8 @@ static void tnewline(int); - static void tputtab(int); - static void tputc(Rune); - static void treset(void); --static void tscrollup(int, int); --static void tscrolldown(int, int); -+static void tscrollup(int, int, int); -+static void tscrolldown(int, int, int); - static void tsetattr(int *, int); - static void tsetchar(Rune, Glyph *, int, int); - static void tsetdirt(int, int); -_AT_@ -431,10 +434,10 @@ tlinelen(int y) - { - int i = term.col; - -- if (term.line[y][i - 1].mode & ATTR_WRAP) -+ if (TLINE(y)[i - 1].mode & ATTR_WRAP) - return i; - -- while (i > 0 && term.line[y][i - 1].u == ' ') -+ while (i > 0 && TLINE(y)[i - 1].u == ' ') - --i; - - return i; -_AT_@ -543,7 +546,7 @@ selsnap(int *x, int *y, int direction) - * Snap around if the word wraps around at the end or - * beginning of a line. - */ -- prevgp = &term.line[*y][*x]; -+ prevgp = &TLINE(*y)[*x]; - prevdelim = ISDELIM(prevgp->u); - for (;;) { - newx = *x + direction; -_AT_@ -558,14 +561,14 @@ selsnap(int *x, int *y, int direction) - yt = *y, xt = *x; - else - yt = newy, xt = newx; -- if (!(term.line[yt][xt].mode & ATTR_WRAP)) -+ if (!(TLINE(yt)[xt].mode & ATTR_WRAP)) - break; - } - - if (newx >= tlinelen(newy)) - break; - -- gp = &term.line[newy][newx]; -+ gp = &TLINE(newy)[newx]; - delim = ISDELIM(gp->u); - if (!(gp->mode & ATTR_WDUMMY) && (delim != prevdelim - || (delim && gp->u != prevgp->u))) -_AT_@ -586,14 +589,14 @@ selsnap(int *x, int *y, int direction) - *x = (direction < 0) ? 0 : term.col - 1; - if (direction < 0) { - for (; *y > 0; *y += direction) { -- if (!(term.line[*y-1][term.col-1].mode -+ if (!(TLINE(*y-1)[term.col-1].mode - & ATTR_WRAP)) { - break; - } - } - } else if (direction > 0) { - for (; *y < term.row-1; *y += direction) { -- if (!(term.line[*y][term.col-1].mode -+ if (!(TLINE(*y)[term.col-1].mode - & ATTR_WRAP)) { - break; - } -_AT_@ -624,13 +627,13 @@ getsel(void) - } - - if (sel.type == SEL_RECTANGULAR) { -- gp = &term.line[y][sel.nb.x]; -+ gp = &TLINE(y)[sel.nb.x]; - lastx = sel.ne.x; - } else { -- gp = &term.line[y][sel.nb.y == y ? sel.nb.x : 0]; -+ gp = &TLINE(y)[sel.nb.y == y ? sel.nb.x : 0]; - lastx = (sel.ne.y == y) ? sel.ne.x : term.col-1; - } -- last = &term.line[y][MIN(lastx, linelen-1)]; -+ last = &TLINE(y)[MIN(lastx, linelen-1)]; - while (last >= gp && last->u == ' ') - --last; - -_AT_@ -836,6 +839,9 @@ ttyread(void) - if (buflen > 0) - memmove(buf, buf + written, buflen); - -+ if (term.scr > 0 && term.scr < HISTSIZE-1) -+ term.scr++; -+ - return ret; - } - -_AT_@ -843,6 +849,9 @@ void - ttywrite(const char *s, size_t n, int may_echo) - { - const char *next; -+ Arg arg = (Arg) { .i = term.scr }; -+ -+ kscrolldown(&arg); - - if (may_echo && IS_SET(MODE_ECHO)) - twrite(s, n, 1); -_AT_@ -1054,13 +1063,54 @@ tswapscreen(void) - } - - void --tscrolldown(int orig, int n) -+kscrolldown(const Arg* a) -+{ -+ int n = a->i; -+ -+ if (n < 0) -+ n = term.row + n; -+ -+ if (n > term.scr) -+ n = term.scr; -+ -+ if (term.scr > 0) { -+ term.scr -= n; -+ selscroll(0, -n); -+ tfulldirt(); -+ } -+} -+ -+void -+kscrollup(const Arg* a) -+{ -+ int n = a->i; -+ -+ if (n < 0) -+ n = term.row + n; -+ -+ if (term.scr <= HISTSIZE-n) { -+ term.scr += n; -+ selscroll(0, n); -+ tfulldirt(); -+ } -+} -+ -+ -+void -+tscrolldown(int orig, int n, int copyhist) - { - int i; - Line temp; - - LIMIT(n, 0, term.bot-orig+1); - -+ if (copyhist) { -+ term.histi = (term.histi - 1 + HISTSIZE) % HISTSIZE; -+ temp = term.hist[term.histi]; -+ term.hist[term.histi] = term.line[term.bot]; -+ term.line[term.bot] = temp; -+ } -+ - tsetdirt(orig, term.bot-n); - tclearregion(0, term.bot-n+1, term.col-1, term.bot); - -_AT_@ -1074,13 +1124,20 @@ tscrolldown(int orig, int n) - } - - void --tscrollup(int orig, int n) -+tscrollup(int orig, int n, int copyhist) - { - int i; - Line temp; - - LIMIT(n, 0, term.bot-orig+1); - -+ if (copyhist) { -+ term.histi = (term.histi + 1) % HISTSIZE; -+ temp = term.hist[term.histi]; -+ term.hist[term.histi] = term.line[orig]; -+ term.line[orig] = temp; -+ } -+ - tclearregion(0, orig, term.col-1, orig+n-1); - tsetdirt(orig+n, term.bot); - -_AT_@ -1129,7 +1186,7 @@ tnewline(int first_col) - int y = term.c.y; - - if (y == term.bot) { -- tscrollup(term.top, 1); -+ tscrollup(term.top, 1, 1); - } else { - y++; - } -_AT_@ -1294,14 +1351,14 @@ void - tinsertblankline(int n) - { - if (BETWEEN(term.c.y, term.top, term.bot)) -- tscrolldown(term.c.y, n); -+ tscrolldown(term.c.y, n, 0); - } - - void - tdeleteline(int n) - { - if (BETWEEN(term.c.y, term.top, term.bot)) -- tscrollup(term.c.y, n); -+ tscrollup(term.c.y, n, 0); - } - - int32_t -_AT_@ -1730,11 +1787,11 @@ csihandle(void) - break; - case 'S': /* SU -- Scroll <n> line up */ - DEFAULT(csiescseq.arg[0], 1); -- tscrollup(term.top, csiescseq.arg[0]); -+ tscrollup(term.top, csiescseq.arg[0], 0); - break; - case 'T': /* SD -- Scroll <n> line down */ - DEFAULT(csiescseq.arg[0], 1); -- tscrolldown(term.top, csiescseq.arg[0]); -+ tscrolldown(term.top, csiescseq.arg[0], 0); - break; - case 'L': /* IL -- Insert <n> blank lines */ - DEFAULT(csiescseq.arg[0], 1); -_AT_@ -2258,7 +2315,7 @@ eschandle(uchar ascii) - return 0; - case 'D': /* IND -- Linefeed */ - if (term.c.y == term.bot) { -- tscrollup(term.top, 1); -+ tscrollup(term.top, 1, 1); - } else { - tmoveto(term.c.x, term.c.y+1); - } -_AT_@ -2271,7 +2328,7 @@ eschandle(uchar ascii) - break; - case 'M': /* RI -- Reverse index */ - if (term.c.y == term.top) { -- tscrolldown(term.top, 1); -+ tscrolldown(term.top, 1, 1); - } else { - tmoveto(term.c.x, term.c.y-1); - } -_AT_@ -2490,7 +2547,7 @@ twrite(const char *buf, int buflen, int show_ctrl) - void - tresize(int col, int row) - { -- int i; -+ int i, j; - int minrow = MIN(row, term.row); - int mincol = MIN(col, term.col); - int *bp; -_AT_@ -2527,7 +2584,15 @@ tresize(int col, int row) - term.dirty = xrealloc(term.dirty, row * sizeof(*term.dirty)); - term.tabs = xrealloc(term.tabs, col * sizeof(*term.tabs)); - -- /* resize each row to new width, zero-pad if needed */ -+ for (i = 0; i < HISTSIZE; i++) { -+ term.hist[i] = xrealloc(term.hist[i], col * sizeof(Glyph)); -+ for (j = mincol; j < col; j++) { -+ term.hist[i][j] = term.c.attr; -+ term.hist[i][j].u = ' '; -+ } -+ } -+ -+ /* resize each r w 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)); -_AT_@ -2584,7 +2649,7 @@ drawregion(int x1, int y1, int x2, int y2) - continue; - - term.dirty[y] = 0; -- xdrawline(term.line[y], x1, y, x2); -+ xdrawline(TLINE(y), x1, y, x2); - } - } - -_AT_@ -2605,8 +2670,10 @@ draw(void) - cx--; - - drawregion(0, 0, term.col, term.row); -- xdrawcursor(cx, term.c.y, term.line[term.c.y][cx], -- term.ocx, term.ocy, term.line[term.ocy][term.ocx]); -+ 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(); - } -diff --git a/st.h b/st.h -index dac64d8..628e876 100644 ---- a/st.h -+++ b/st.h -_AT_@ -3,6 +3,9 @@ - #include <stdint.h> - #include <sys/types.h> - -+/* Arbitrary size */ -+#define HISTSIZE 2000 -+ - /* macros */ - #define MIN(a, b) ((a) < (b) ? (a) : (b)) - #define MAX(a, b) ((a) < (b) ? (b) : (a)) -_AT_@ -19,6 +22,8 @@ - - #define TRUECOLOR(r,g,b) (1 << 24 | (r) << 16 | (g) << 8 | (b)) - #define IS_TRUECOL(x) (1 << 24 & (x)) -+#define TLINE(y) ((y) < term.scr ? term.hist[((y) + term.histi - term.scr \ -+ + HISTSIZE + 1) % HISTSIZE] : term.line[(y) - term.scr]) - - enum glyph_attribute { - ATTR_NULL = 0, -_AT_@ -111,6 +116,9 @@ void *xmalloc(size_t); - void *xrealloc(void *, size_t); - char *xstrdup(char *); - -+void kscrolldown(const Arg *); -+void kscrollup(const Arg *); -+ - /* config.h globals */ - extern char *utmp; - extern char *stty_args; diff --git a/st.suckless.org/patches/scrollback/st-scrollback-0.8.2.diff b/st.suckless.org/patches/scrollback/st-scrollback-20201205-4ef0cbd.diff similarity index 80% rename from st.suckless.org/patches/scrollback/st-scrollback-0.8.2.diff rename to st.suckless.org/patches/scrollback/st-scrollback-20201205-4ef0cbd.diff index c961fd28..863306e1 100644 --- a/st.suckless.org/patches/scrollback/st-scrollback-0.8.2.diff +++ b/st.suckless.org/patches/scrollback/st-scrollback-20201205-4ef0cbd.diff _AT_@ -1,29 +1,18 @@ -From aecdff3915abe3e8b41275ea7f13f3ac6c54eb4a Mon Sep 17 00:00:00 2001 -From: Jacob Prosser <jacoblouisprosser_AT_protonmail.com> -Date: Thu, 25 Apr 2019 12:55:32 +1000 -Subject: [PATCH] Scrollback w/ mouse - ---- - config.def.h | 2 + - st.c | 115 ++++++++++++++++++++++++++++++++++++++++----------- - st.h | 2 + - 3 files changed, 95 insertions(+), 24 deletions(-) - diff --git a/config.def.h b/config.def.h -index 0e01717..7326a74 100644 +index 6f05dce..93cbcc0 100644 --- a/config.def.h +++ b/config.def.h -_AT_@ -176,6 +176,8 @@ static Shortcut shortcuts[] = { - { TERMMOD, XK_C, clipcopy, {.i = 0} }, - { TERMMOD, XK_V, clippaste, {.i = 0} }, +_AT_@ -199,6 +199,8 @@ static Shortcut shortcuts[] = { { TERMMOD, XK_Y, selpaste, {.i = 0} }, -+ { ShiftMask, XK_Page_Up, kscrollup, {.i = -1} }, -+ { ShiftMask, XK_Page_Down, kscrolldown, {.i = -1} }, { ShiftMask, XK_Insert, selpaste, {.i = 0} }, { TERMMOD, XK_Num_Lock, numlock, {.i = 0} }, ++ { ShiftMask, XK_Page_Up, kscrollup, {.i = -1} }, ++ { ShiftMask, XK_Page_Down, kscrolldown, {.i = -1} }, }; + + /* diff --git a/st.c b/st.c -index b8e6077..07e71e1 100644 +index abbbe4b..e2dd722 100644 --- a/st.c +++ b/st.c _AT_@ -35,6 +35,7 @@ _AT_@ -37,14 +26,14 @@ index b8e6077..07e71e1 100644 _AT_@ -42,6 +43,9 @@ #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]) enum term_mode { MODE_WRAP = 1 << 0, -_AT_@ -117,6 +121,9 @@ typedef struct { +_AT_@ -115,6 +119,9 @@ typedef struct { int col; /* nb col */ Line *line; /* screen */ Line *alt; /* alternate screen */ _AT_@ -65,7 +54,7 @@ index b8e6077..07e71e1 100644 static void tsetattr(int *, int); static void tsetchar(Rune, Glyph *, int, int); static void tsetdirt(int, int); -_AT_@ -427,10 +434,10 @@ tlinelen(int y) +_AT_@ -414,10 +421,10 @@ tlinelen(int y) { int i = term.col; _AT_@ -78,7 +67,7 @@ index b8e6077..07e71e1 100644 --i; return i; -_AT_@ -539,7 +546,7 @@ selsnap(int *x, int *y, int direction) +_AT_@ -526,7 +533,7 @@ selsnap(int *x, int *y, int direction) * Snap around if the word wraps around at the end or * beginning of a line. */ _AT_@ -87,7 +76,7 @@ index b8e6077..07e71e1 100644 prevdelim = ISDELIM(prevgp->u); for (;;) { newx = *x + direction; -_AT_@ -554,14 +561,14 @@ selsnap(int *x, int *y, int direction) +_AT_@ -541,14 +548,14 @@ selsnap(int *x, int *y, int direction) yt = *y, xt = *x; else yt = newy, xt = newx; _AT_@ -104,7 +93,7 @@ index b8e6077..07e71e1 100644 delim = ISDELIM(gp->u); if (!(gp->mode & ATTR_WDUMMY) && (delim != prevdelim || (delim && gp->u != prevgp->u))) -_AT_@ -582,14 +589,14 @@ selsnap(int *x, int *y, int direction) +_AT_@ -569,14 +576,14 @@ selsnap(int *x, int *y, int direction) *x = (direction < 0) ? 0 : term.col - 1; if (direction < 0) { for (; *y > 0; *y += direction) { _AT_@ -121,7 +110,7 @@ index b8e6077..07e71e1 100644 & ATTR_WRAP)) { break; } -_AT_@ -620,13 +627,13 @@ getsel(void) +_AT_@ -607,13 +614,13 @@ getsel(void) } if (sel.type == SEL_RECTANGULAR) { _AT_@ -138,7 +127,7 @@ index b8e6077..07e71e1 100644 while (last >= gp && last->u == ' ') --last; -_AT_@ -849,6 +856,9 @@ void +_AT_@ -848,6 +855,9 @@ void ttywrite(const char *s, size_t n, int may_echo) { const char *next; _AT_@ -148,11 +137,11 @@ index b8e6077..07e71e1 100644 if (may_echo && IS_SET(MODE_ECHO)) twrite(s, n, 1); -_AT_@ -1058,15 +1068,53 @@ tswapscreen(void) - term.mode ^= MODE_ALTSCREEN; - tfulldirt(); +_AT_@ -1059,13 +1069,53 @@ tswapscreen(void) } -+void + + void +-tscrolldown(int orig, int n) +kscrolldown(const Arg* a) +{ + int n = a->i; _AT_@ -174,6 +163,7 @@ index b8e6077..07e71e1 100644 +kscrollup(const Arg* a) +{ + int n = a->i; ++ + if (n < 0) + n = term.row + n; + _AT_@ -183,9 +173,8 @@ index b8e6077..07e71e1 100644 + tfulldirt(); + } +} - - void --tscrolldown(int orig, int n) ++ ++void +tscrolldown(int orig, int n, int copyhist) { int i; _AT_@ -203,7 +192,13 @@ index b8e6077..07e71e1 100644 tsetdirt(orig, term.bot-n); tclearregion(0, term.bot-n+1, term.col-1, term.bot); -_AT_@ -1080,13 +1128,23 @@ tscrolldown(int orig, int n) +_AT_@ -1075,17 +1125,28 @@ tscrolldown(int orig, int n) + term.line[i-n] = temp; + } + +- selscroll(orig, n); ++ if (term.scr == 0) ++ selscroll(orig, n); } void _AT_@ -228,7 +223,17 @@ index b8e6077..07e71e1 100644 tclearregion(0, orig, term.col-1, orig+n-1); tsetdirt(orig+n, term.bot); -_AT_@ -1135,7 +1193,7 @@ tnewline(int first_col) +_AT_@ -1095,7 +1156,8 @@ tscrollup(int orig, int n) + term.line[i+n] = temp; + } + +- selscroll(orig, -n); ++ if (term.scr == 0) ++ selscroll(orig, -n); + } + + void +_AT_@ -1124,7 +1186,7 @@ tnewline(int first_col) int y = term.c.y; if (y == term.bot) { _AT_@ -237,7 +242,7 @@ index b8e6077..07e71e1 100644 } else { y++; } -_AT_@ -1300,14 +1358,14 @@ void +_AT_@ -1289,14 +1351,14 @@ void tinsertblankline(int n) { if (BETWEEN(term.c.y, term.top, term.bot)) _AT_@ -254,7 +259,7 @@ index b8e6077..07e71e1 100644 } int32_t -_AT_@ -1737,11 +1795,11 @@ csihandle(void) +_AT_@ -1733,11 +1795,11 @@ csihandle(void) break; case 'S': /* SU -- Scroll <n> line up */ DEFAULT(csiescseq.arg[0], 1); _AT_@ -268,7 +273,7 @@ index b8e6077..07e71e1 100644 break; case 'L': /* IL -- Insert <n> blank lines */ DEFAULT(csiescseq.arg[0], 1); -_AT_@ -2243,7 +2301,7 @@ eschandle(uchar ascii) +_AT_@ -2249,7 +2311,7 @@ eschandle(uchar ascii) return 0; case 'D': /* IND -- Linefeed */ if (term.c.y == term.bot) { _AT_@ -277,7 +282,7 @@ index b8e6077..07e71e1 100644 } else { tmoveto(term.c.x, term.c.y+1); } -_AT_@ -2256,7 +2314,7 @@ eschandle(uchar ascii) +_AT_@ -2262,7 +2324,7 @@ eschandle(uchar ascii) break; case 'M': /* RI -- Reverse index */ if (term.c.y == term.top) { _AT_@ -286,7 +291,7 @@ index b8e6077..07e71e1 100644 } else { tmoveto(term.c.x, term.c.y-1); } -_AT_@ -2475,7 +2533,7 @@ twrite(const char *buf, int buflen, int show_ctrl) +_AT_@ -2472,7 +2534,7 @@ twrite(const char *buf, int buflen, int show_ctrl) void tresize(int col, int row) { _AT_@ -295,7 +300,7 @@ index b8e6077..07e71e1 100644 int minrow = MIN(row, term.row); int mincol = MIN(col, term.col); int *bp; -_AT_@ -2512,6 +2570,14 @@ tresize(int col, int row) +_AT_@ -2509,6 +2571,14 @@ tresize(int col, int row) term.dirty = xrealloc(term.dirty, row * sizeof(*term.dirty)); term.tabs = xrealloc(term.tabs, col * sizeof(*term.tabs)); _AT_@ -310,7 +315,7 @@ index b8e6077..07e71e1 100644 /* 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)); -_AT_@ -2569,7 +2635,7 @@ drawregion(int x1, int y1, int x2, int y2) +_AT_@ -2567,7 +2637,7 @@ drawregion(int x1, int y1, int x2, int y2) continue; term.dirty[y] = 0; _AT_@ -319,21 +324,23 @@ index b8e6077..07e71e1 100644 } } -_AT_@ -2590,7 +2656,8 @@ draw(void) +_AT_@ -2588,8 +2658,9 @@ draw(void) cx--; drawregion(0, 0, term.col, term.row); - xdrawcursor(cx, term.c.y, term.line[term.c.y][cx], +- term.ocx, term.ocy, term.line[term.ocy][term.ocx]); + 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; ++ term.ocx, term.ocy, term.line[term.ocy][term.ocx]); + term.ocx = cx; + term.ocy = term.c.y; xfinishdraw(); diff --git a/st.h b/st.h -index 38c61c4..17a79e0 100644 +index 3d351b6..f44e1d3 100644 --- a/st.h +++ b/st.h -_AT_@ -80,6 +80,8 @@ void die(const char *, ...); +_AT_@ -81,6 +81,8 @@ void die(const char *, ...); void redraw(void); void draw(void); _AT_@ -342,6 +349,3 @@ index 38c61c4..17a79e0 100644 void printscreen(const Arg *); void printsel(const Arg *); void sendbreak(const Arg *); --- -2.21.0 -Received on Sat Dec 05 2020 - 14:15:38 CET
This archive was generated by hypermail 2.3.0 : Sat Dec 05 2020 - 14:24:42 CET