[wiki] [sites] [st][scrollback] Update for latest git || Jochen Sprickerhof

From: <git_AT_suckless.org>
Date: Mon, 24 Dec 2018 16:26:05 +0100

commit e6e3b67624864048fbce030c24ab673f64380b73
Author: Jochen Sprickerhof <git_AT_jochen.sprickerhof.de>
Date: Mon Dec 24 16:24:52 2018 +0100

    [st][scrollback] Update for latest git

diff --git a/st.suckless.org/patches/scrollback/index.md b/st.suckless.org/patches/scrollback/index.md
index 6ee26c42..01168790 100644
--- a/st.suckless.org/patches/scrollback/index.md
+++ b/st.suckless.org/patches/scrollback/index.md
_AT_@ -10,8 +10,8 @@ Download
 --------
 
 * [st-scrollback-0.7.diff](st-scrollback-0.7.diff)
-* [st-scrollback-20170329-149c0d3.diff](st-scrollback-20170329-149c0d3.diff)
 * [st-scrollback-0.8.diff](st-scrollback-0.8.diff)
+* [st-scrollback-20181224-096b125.diff](st-scrollback-20181224-096b125.diff)
 
 Apply the following patch on top of the previous to allow scrolling
 using `Shift+MouseWheel`.
diff --git a/st.suckless.org/patches/scrollback/st-scrollback-20170329-149c0d3.diff b/st.suckless.org/patches/scrollback/st-scrollback-20181224-096b125.diff
similarity index 68%
rename from st.suckless.org/patches/scrollback/st-scrollback-20170329-149c0d3.diff
rename to st.suckless.org/patches/scrollback/st-scrollback-20181224-096b125.diff
index e202bda8..98e0e2ab 100644
--- a/st.suckless.org/patches/scrollback/st-scrollback-20170329-149c0d3.diff
+++ b/st.suckless.org/patches/scrollback/st-scrollback-20181224-096b125.diff
_AT_@ -1,41 +1,60 @@
 diff --git a/config.def.h b/config.def.h
-index 877afab..3e9cda5 100644
+index 823e79f..f6278a3 100644
 --- a/config.def.h
 +++ b/config.def.h
-_AT_@ -178,6 +178,8 @@ Shortcut shortcuts[] = {
+_AT_@ -177,6 +177,8 @@ static Shortcut shortcuts[] = {
+ { TERMMOD, XK_V, clippaste, {.i = 0} },
          { 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 ae93ade..b74b9dc 100644
+index b8e6077..218ae73 100644
 --- a/st.c
 +++ b/st.c
-_AT_@ -128,6 +128,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 zoom(const Arg *);
-_AT_@ -174,8 +176,8 @@ static void tputtab(int);
+_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_@ -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 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 {
+ 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_@ -184,8 +191,8 @@ static void tnewline(int);
+ 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_@ -448,10 +450,10 @@ tlinelen(int y)
+ static void tsetdirt(int, int);
+_AT_@ -427,10 +434,10 @@ tlinelen(int y)
  {
          int i = term.col;
  
_AT_@ -48,7 +67,7 @@ index ae93ade..b74b9dc 100644
                  --i;
  
          return i;
-_AT_@ -513,7 +515,7 @@ selsnap(int *x, int *y, int direction)
+_AT_@ -539,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.
                   */
_AT_@ -57,7 +76,7 @@ index ae93ade..b74b9dc 100644
                  prevdelim = ISDELIM(prevgp->u);
                  for (;;) {
                          newx = *x + direction;
-_AT_@ -528,14 +530,14 @@ selsnap(int *x, int *y, int direction)
+_AT_@ -554,14 +561,14 @@ selsnap(int *x, int *y, int direction)
                                          yt = *y, xt = *x;
                                  else
                                          yt = newy, xt = newx;
_AT_@ -74,7 +93,7 @@ index ae93ade..b74b9dc 100644
                          delim = ISDELIM(gp->u);
                          if (!(gp->mode & ATTR_WDUMMY) && (delim != prevdelim
                                          || (delim && gp->u != prevgp->u)))
-_AT_@ -556,14 +558,14 @@ selsnap(int *x, int *y, int direction)
+_AT_@ -582,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) {
_AT_@ -91,7 +110,7 @@ index ae93ade..b74b9dc 100644
                                                  & ATTR_WRAP)) {
                                          break;
                                  }
-_AT_@ -594,13 +596,13 @@ getsel(void)
+_AT_@ -620,13 +627,13 @@ getsel(void)
                  }
  
                  if (sel.type == SEL_RECTANGULAR) {
_AT_@ -108,27 +127,17 @@ index ae93ade..b74b9dc 100644
                  while (last >= gp && last->u == ' ')
                          --last;
  
-_AT_@ -844,6 +846,9 @@ ttyread(void)
- if (buflen > 0)
- memmove(buf, ptr, buflen);
-
-+ if (term.scr > 0 && term.scr < HISTSIZE-1)
-+ term.scr++;
-+
- return ret;
- }
-
-_AT_@ -853,6 +858,9 @@ ttywrite(const char *s, size_t n)
- fd_set wfd, rfd;
- ssize_t r;
- size_t lim = 256;
+_AT_@ -849,6 +856,9 @@ void
+ ttywrite(const char *s, size_t n, int may_echo)
+ {
+ const char *next;
 + Arg arg = (Arg) { .i = term.scr };
 +
 + kscrolldown(&arg);
  
- /*
- * Remember that we are using a pty, which might be a modem line.
-_AT_@ -1055,13 +1063,53 @@ tswapscreen(void)
+ if (may_echo && IS_SET(MODE_ECHO))
+ twrite(s, n, 1);
+_AT_@ -1060,13 +1070,53 @@ tswapscreen(void)
  }
  
  void
_AT_@ -183,7 +192,7 @@ index ae93ade..b74b9dc 100644
          tsetdirt(orig, term.bot-n);
          tclearregion(0, term.bot-n+1, term.col-1, term.bot);
  
-_AT_@ -1075,13 +1123,20 @@ tscrolldown(int orig, int n)
+_AT_@ -1080,13 +1130,23 @@ tscrolldown(int orig, int n)
  }
  
  void
_AT_@ -201,11 +210,14 @@ index ae93ade..b74b9dc 100644
 + 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_@ -1130,7 +1185,7 @@ tnewline(int first_col)
+_AT_@ -1135,7 +1195,7 @@ tnewline(int first_col)
          int y = term.c.y;
  
          if (y == term.bot) {
_AT_@ -214,7 +226,7 @@ index ae93ade..b74b9dc 100644
          } else {
                  y++;
          }
-_AT_@ -1295,14 +1350,14 @@ void
+_AT_@ -1300,14 +1360,14 @@ void
  tinsertblankline(int n)
  {
          if (BETWEEN(term.c.y, term.top, term.bot))
_AT_@ -231,7 +243,7 @@ index ae93ade..b74b9dc 100644
  }
  
  int32_t
-_AT_@ -1736,11 +1791,11 @@ csihandle(void)
+_AT_@ -1737,11 +1797,11 @@ csihandle(void)
                  break;
          case 'S': /* SU -- Scroll <n> line up */
                  DEFAULT(csiescseq.arg[0], 1);
_AT_@ -245,7 +257,7 @@ index ae93ade..b74b9dc 100644
                  break;
          case 'L': /* IL -- Insert <n> blank lines */
                  DEFAULT(csiescseq.arg[0], 1);
-_AT_@ -2290,7 +2345,7 @@ eschandle(uchar ascii)
+_AT_@ -2243,7 +2303,7 @@ eschandle(uchar ascii)
                  return 0;
          case 'D': /* IND -- Linefeed */
                  if (term.c.y == term.bot) {
_AT_@ -254,7 +266,7 @@ index ae93ade..b74b9dc 100644
                  } else {
                          tmoveto(term.c.x, term.c.y+1);
                  }
-_AT_@ -2303,7 +2358,7 @@ eschandle(uchar ascii)
+_AT_@ -2256,7 +2316,7 @@ eschandle(uchar ascii)
                  break;
          case 'M': /* RI -- Reverse index */
                  if (term.c.y == term.top) {
_AT_@ -263,7 +275,7 @@ index ae93ade..b74b9dc 100644
                  } else {
                          tmoveto(term.c.x, term.c.y-1);
                  }
-_AT_@ -2490,7 +2545,7 @@ check_control_code:
+_AT_@ -2475,7 +2535,7 @@ twrite(const char *buf, int buflen, int show_ctrl)
  void
  tresize(int col, int row)
  {
_AT_@ -272,7 +284,7 @@ index ae93ade..b74b9dc 100644
          int minrow = MIN(row, term.row);
          int mincol = MIN(col, term.col);
          int *bp;
-_AT_@ -2530,6 +2585,14 @@ tresize(int col, int row)
+_AT_@ -2512,6 +2572,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_@ -287,64 +299,37 @@ index ae93ade..b74b9dc 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));
-diff --git a/st.h b/st.h
-index 44d4938..2d9b028 100644
---- a/st.h
-+++ b/st.h
-_AT_@ -2,6 +2,7 @@
+_AT_@ -2569,7 +2637,7 @@ drawregion(int x1, int y1, int x2, int y2)
+ continue;
  
- /* Arbitrary sizes */
- #define UTF_SIZ 4
-+#define HISTSIZE 2000
-
- /* macros */
- #define MIN(a, b) ((a) < (b) ? (a) : (b))
-_AT_@ -20,6 +21,9 @@
- #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,
- ATTR_BOLD = 1 << 0,
-_AT_@ -114,6 +118,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 */
- GlyphFontSpec *specbuf; /* font spec buffer used for rendering */
- TCursor c; /* cursor */
-diff --git a/x.c b/x.c
-index b7339e9..2ae8b17 100644
---- a/x.c
-+++ b/x.c
-_AT_@ -1413,11 +1413,11 @@ drawregion(int x1, int y1, int x2, int y2)
                  term.dirty[y] = 0;
+- xdrawline(term.line[y], x1, y, x2);
++ xdrawline(TLINE(y), x1, y, x2);
+ }
+ }
  
- specs = term.specbuf;
-- numspecs = xmakeglyphfontspecs(specs, &term.line[y][x1], x2 - x1, x1, y);
-+ numspecs = xmakeglyphfontspecs(specs, &TLINE(y)[x1], x2 - x1, x1, y);
+_AT_@ -2590,8 +2658,9 @@ draw(void)
+ cx--;
  
- 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_@ -1437,7 +1437,9 @@ drawregion(int x1, int y1, int x2, int y2)
- if (i > 0)
- xdrawglyphfontspecs(specs, base, i, ox, y);
- }
-- xdrawcursor();
-+
+ 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();
++ 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 38c61c4..17a79e0 100644
+--- a/st.h
++++ b/st.h
+_AT_@ -80,6 +80,8 @@ void die(const char *, ...);
+ void redraw(void);
+ void draw(void);
  
- void
++void kscrolldown(const Arg *);
++void kscrollup(const Arg *);
+ void printscreen(const Arg *);
+ void printsel(const Arg *);
+ void sendbreak(const Arg *);
Received on Mon Dec 24 2018 - 16:26:05 CET

This archive was generated by hypermail 2.3.0 : Mon Dec 24 2018 - 16:36:25 CET