st

Custom st fork
git clone git://git.deurzen.net/st
Log | Files | Refs | README | LICENSE

commit b937efc530b45c52f53f13671be90d7c8a07ba67
parent 4d5307bf0ce3c306ff27aabc62e1b5a0cb054096
Author: deurzen <m.deurzen@tum.de>
Date:   Thu, 14 Jan 2021 01:39:25 +0100

adds patch files

Diffstat:
Apatches/st-cyclefonts-0.8.4.diff | 82+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Apatches/st-desktopentry-0.8.2.diff | 44++++++++++++++++++++++++++++++++++++++++++++
Apatches/st-disable-font-styling-0.8.2.diff | 57+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Apatches/st-scrollback-0.8.4.diff | 351+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Apatches/st-scrollback-mouse-20191024-a2c479c.diff | 13+++++++++++++
Apatches/st-scrollback-mouse-altscreen-20200416-5703aa0.diff | 63+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Apatches/st-scrollback-mouse-increment-0.8.2.diff | 34++++++++++++++++++++++++++++++++++
Apatches/st-spoiler-20180309-c5ba9c0.diff | 21+++++++++++++++++++++
Apatches/st-swapmouse-0.8.4.diff | 37+++++++++++++++++++++++++++++++++++++
9 files changed, 702 insertions(+), 0 deletions(-)

diff --git a/patches/st-cyclefonts-0.8.4.diff b/patches/st-cyclefonts-0.8.4.diff @@ -0,0 +1,82 @@ +From 9262cecf21a3a2fcf5f5c0f7dcc872fdc5435ca1 Mon Sep 17 00:00:00 2001 +From: Miles Alan <m@milesalan.com> +Date: Mon, 7 Dec 2020 21:16:37 -0600 +Subject: [PATCH] cyclefont: Add keybinding to cycle between multiple different + fonts + +--- + config.def.h | 8 +++++++- + x.c | 17 +++++++++++++++-- + 2 files changed, 22 insertions(+), 3 deletions(-) + +diff --git a/config.def.h b/config.def.h +index 6f05dce..5cd506c 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -5,7 +5,12 @@ + * + * font: see http://freedesktop.org/software/fontconfig/fontconfig-user.html + */ +-static char *font = "Liberation Mono:pixelsize=12:antialias=true:autohint=true"; ++static char *fonts[] = { ++ "Liberation Mono:pixelsize=12:antialias=true:autohint=true", ++ "tewi:pixelsize=12:antialias=true:autohint=true" ++}; ++static int fonts_current = 0; ++ + static int borderpx = 2; + + /* +@@ -199,6 +204,7 @@ static Shortcut shortcuts[] = { + { TERMMOD, XK_Y, selpaste, {.i = 0} }, + { ShiftMask, XK_Insert, selpaste, {.i = 0} }, + { TERMMOD, XK_Num_Lock, numlock, {.i = 0} }, ++ { TERMMOD, XK_S, cyclefonts, {} }, + }; + + /* +diff --git a/x.c b/x.c +index 210f184..88cb8e7 100644 +--- a/x.c ++++ b/x.c +@@ -59,6 +59,7 @@ static void zoom(const Arg *); + static void zoomabs(const Arg *); + static void zoomreset(const Arg *); + static void ttysend(const Arg *); ++static void cyclefonts(const Arg *); + + /* config.h for applying patches and the configuration. */ + #include "config.h" +@@ -949,6 +950,18 @@ xloadfont(Font *f, FcPattern *pattern) + return 0; + } + ++void ++cyclefonts(const Arg *dummy) ++{ ++ fonts_current++; ++ if (fonts_current > (sizeof fonts / sizeof fonts[0]) - 1) { ++ fonts_current = 0; ++ } ++ usedfont = fonts[fonts_current]; ++ xloadfonts(fonts[fonts_current], 0); ++ redraw(); ++} ++ + void + xloadfonts(char *fontstr, double fontsize) + { +@@ -1113,8 +1126,8 @@ xinit(int cols, int rows) + if (!FcInit()) + die("could not init fontconfig.\n"); + +- usedfont = (opt_font == NULL)? font : opt_font; +- xloadfonts(usedfont, 0); ++ usedfont = fonts[fonts_current]; ++ xloadfonts(fonts[fonts_current], 0); + + /* colors */ + xw.cmap = XDefaultColormap(xw.dpy, xw.scr); +-- +2.26.2 + diff --git a/patches/st-desktopentry-0.8.2.diff b/patches/st-desktopentry-0.8.2.diff @@ -0,0 +1,44 @@ +From 0ba2850930d2ef22a1774f3dc78884c978f2d8be Mon Sep 17 00:00:00 2001 +From: aleks <aleks.stier@icloud.com> +Date: Wed, 27 May 2020 01:20:00 +0200 +Subject: [PATCH] Create a desktop-entry for st + +--- + Makefile | 3 +++ + st.desktop | 7 +++++++ + 2 files changed, 10 insertions(+) + create mode 100644 st.desktop + +diff --git a/Makefile b/Makefile +index ed19e70..29e25b9 100644 +--- a/Makefile ++++ b/Makefile +@@ -50,9 +50,12 @@ install: st + chmod 644 $(DESTDIR)$(MANPREFIX)/man1/st.1 + tic -sx st.info + @echo Please see the README file regarding the terminfo entry of st. ++ mkdir -p $(DESTDIR)$(PREFIX)/share/applications ++ cp -f st.desktop $(DESTDIR)$(PREFIX)/share/applications + + uninstall: + rm -f $(DESTDIR)$(PREFIX)/bin/st + rm -f $(DESTDIR)$(MANPREFIX)/man1/st.1 ++ rm -f $(DESTDIR)$(PREFIX)/share/applications/st.desktop + + .PHONY: all options clean dist install uninstall +diff --git a/st.desktop b/st.desktop +new file mode 100644 +index 0000000..a1b5116 +--- /dev/null ++++ b/st.desktop +@@ -0,0 +1,7 @@ ++[Desktop Entry] ++Type=Application ++Name=st ++Comment=simple-terminal emulator for X ++Icon=utilities-terminal ++Exec=st ++Categories=System;TerminalEmulator +-- +2.26.2 + diff --git a/patches/st-disable-font-styling-0.8.2.diff b/patches/st-disable-font-styling-0.8.2.diff @@ -0,0 +1,57 @@ +diff --git a/config.def.h b/config.def.h +index 00d289c..01f01b6 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -6,6 +6,12 @@ + * font: see http://freedesktop.org/software/fontconfig/fontconfig-user.html + */ + static char *font = "xos4 Terminus:pixelsize=12"; ++ ++/* disable bold, italic and roman fonts globally */ ++int disablebold = 1; ++int disableitalic = 1; ++int disableroman = 0; ++ + static int borderpx = 2; + + /* +diff --git a/x.c b/x.c +index e9fd6e9..8623711 100644 +--- a/x.c ++++ b/x.c +@@ -229,6 +229,11 @@ static char *usedfont = NULL; + static double usedfontsize = 0; + static double defaultfontsize = 0; + ++/* declared in config.h */ ++extern int disablebold; ++extern int disableitalic; ++extern int disableroman; ++ + static char *opt_class = NULL; + static char **opt_cmd = NULL; + static char *opt_embed = NULL; +@@ -966,17 +971,20 @@ xloadfonts(char *fontstr, double fontsize) + win.ch = ceilf(dc.font.height * chscale); + + FcPatternDel(pattern, FC_SLANT); +- FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ITALIC); ++ if (!disableitalic) ++ FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ITALIC); + if (xloadfont(&dc.ifont, pattern)) + die("can't open font %s\n", fontstr); + + FcPatternDel(pattern, FC_WEIGHT); +- FcPatternAddInteger(pattern, FC_WEIGHT, FC_WEIGHT_BOLD); ++ if (!disablebold) ++ FcPatternAddInteger(pattern, FC_WEIGHT, FC_WEIGHT_BOLD); + if (xloadfont(&dc.ibfont, pattern)) + die("can't open font %s\n", fontstr); + + FcPatternDel(pattern, FC_SLANT); +- FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ROMAN); ++ if (!disableroman) ++ FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ROMAN); + if (xloadfont(&dc.bfont, pattern)) + die("can't open font %s\n", fontstr); + diff --git a/patches/st-scrollback-0.8.4.diff b/patches/st-scrollback-0.8.4.diff @@ -0,0 +1,351 @@ +diff --git a/config.def.h b/config.def.h +index 6f05dce..93cbcc0 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -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} }, ++ { ShiftMask, XK_Page_Up, kscrollup, {.i = -1} }, ++ { ShiftMask, XK_Page_Down, kscrolldown, {.i = -1} }, + }; + + /* +diff --git a/st.c b/st.c +index 76b7e0d..edec064 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,6 +43,9 @@ + #define ISCONTROLC1(c) (BETWEEN(c, 0x80, 0x9f)) + #define ISCONTROL(c) (ISCONTROLC0(c) || ISCONTROLC1(c)) + #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, +@@ -115,6 +119,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 */ +@@ -184,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); +@@ -414,10 +421,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; +@@ -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. + */ +- prevgp = &term.line[*y][*x]; ++ prevgp = &TLINE(*y)[*x]; + prevdelim = ISDELIM(prevgp->u); + for (;;) { + newx = *x + direction; +@@ -541,14 +548,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))) +@@ -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) { +- 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; + } +@@ -607,13 +614,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; + +@@ -848,6 +855,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); +@@ -1059,13 +1069,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); + +@@ -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 +-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); + +@@ -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 +@@ -1124,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++; + } +@@ -1289,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 +@@ -1733,11 +1795,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); +@@ -2241,7 +2303,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); + } +@@ -2254,7 +2316,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); + } +@@ -2464,7 +2526,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; +@@ -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)); + ++ 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)); +@@ -2559,7 +2629,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); + } + } + +@@ -2580,8 +2650,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 3d351b6..f44e1d3 100644 +--- a/st.h ++++ b/st.h +@@ -81,6 +81,8 @@ void die(const char *, ...); + void redraw(void); + void draw(void); + ++void kscrolldown(const Arg *); ++void kscrollup(const Arg *); + void printscreen(const Arg *); + void printsel(const Arg *); + void sendbreak(const Arg *); diff --git a/patches/st-scrollback-mouse-20191024-a2c479c.diff b/patches/st-scrollback-mouse-20191024-a2c479c.diff @@ -0,0 +1,13 @@ +diff --git a/config.def.h b/config.def.h +index ec1b576..4b3bf15 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -163,6 +163,8 @@ static uint forcemousemod = ShiftMask; + */ + static MouseShortcut mshortcuts[] = { + /* mask button function argument release */ ++ { ShiftMask, Button4, kscrollup, {.i = 1} }, ++ { ShiftMask, Button5, kscrolldown, {.i = 1} }, + { XK_ANY_MOD, Button2, selpaste, {.i = 0}, 1 }, + { XK_ANY_MOD, Button4, ttysend, {.s = "\031"} }, + { XK_ANY_MOD, Button5, ttysend, {.s = "\005"} }, diff --git a/patches/st-scrollback-mouse-altscreen-20200416-5703aa0.diff b/patches/st-scrollback-mouse-altscreen-20200416-5703aa0.diff @@ -0,0 +1,63 @@ +diff --git a/config.def.h b/config.def.h +index 4b3bf15..1986316 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -163,8 +163,8 @@ static uint forcemousemod = ShiftMask; + */ + static MouseShortcut mshortcuts[] = { + /* mask button function argument release */ +- { ShiftMask, Button4, kscrollup, {.i = 1} }, +- { ShiftMask, Button5, kscrolldown, {.i = 1} }, ++ { XK_ANY_MOD, Button4, kscrollup, {.i = 1}, 0, /* !alt */ -1 }, ++ { XK_ANY_MOD, Button5, kscrolldown, {.i = 1}, 0, /* !alt */ -1 }, + { XK_ANY_MOD, Button2, selpaste, {.i = 0}, 1 }, + { XK_ANY_MOD, Button4, ttysend, {.s = "\031"} }, + { XK_ANY_MOD, Button5, ttysend, {.s = "\005"} }, +diff --git a/st.c b/st.c +index f8b6f67..dd4cb31 100644 +--- st.c ++++ st.c +@@ -1045,6 +1045,11 @@ tnew(int col, int row) + treset(); + } + ++int tisaltscr(void) ++{ ++ return IS_SET(MODE_ALTSCREEN); ++} ++ + void + tswapscreen(void) + { +diff --git a/st.h b/st.h +index 1332cf1..f9ad815 100644 +--- st.h ++++ st.h +@@ -89,6 +89,7 @@ void sendbreak(const Arg *); + void toggleprinter(const Arg *); + + int tattrset(int); ++int tisaltscr(void); + void tnew(int, int); + void tresize(int, int); + void tsetdirtattr(int); +diff --git a/x.c b/x.c +index e5f1737..b8fbd7b 100644 +--- x.c ++++ x.c +@@ -34,6 +34,7 @@ typedef struct { + void (*func)(const Arg *); + const Arg arg; + uint release; ++ int altscrn; /* 0: don't care, -1: not alt screen, 1: alt screen */ + } MouseShortcut; + + typedef struct { +@@ -446,6 +447,7 @@ mouseaction(XEvent *e, uint release) + for (ms = mshortcuts; ms < mshortcuts + LEN(mshortcuts); ms++) { + if (ms->release == release && + ms->button == e->xbutton.button && ++ (!ms->altscrn || (ms->altscrn == (tisaltscr() ? 1 : -1))) && + (match(ms->mod, state) || /* exact or forced */ + match(ms->mod, state & ~forcemousemod))) { + ms->func(&(ms->arg)); diff --git a/patches/st-scrollback-mouse-increment-0.8.2.diff b/patches/st-scrollback-mouse-increment-0.8.2.diff @@ -0,0 +1,34 @@ +From 63e717e51dcd2f59c7a3aa75b659926aa92e08f3 Mon Sep 17 00:00:00 2001 +From: Jacob Louis Prosser <geriatricjacob@cumallover.me> +Date: Mon, 5 Aug 2019 18:20:25 +1000 +Subject: [st] [patch] Exposed variable to easily change mouse scroll increment. + +--- + config.def.h | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/config.def.h b/config.def.h +index ad20c4c..47e4b66 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -154,6 +154,7 @@ static unsigned int defaultattr = 11; + * Internal mouse shortcuts. + * Beware that overloading Button1 will disable the selection. + */ ++const unsigned int mousescrollincrement = 1; + static MouseShortcut mshortcuts[] = { + /* button mask string */ + { Button4, XK_NO_MOD, "\031" }, +@@ -162,8 +163,8 @@ static MouseShortcut mshortcuts[] = { + + MouseKey mkeys[] = { + /* button mask function argument */ +- { Button4, ShiftMask, kscrollup, {.i = 1} }, +- { Button5, ShiftMask, kscrolldown, {.i = 1} }, ++ { Button4, ShiftMask, kscrollup, {.i = mousescrollincrement} }, ++ { Button5, ShiftMask, kscrolldown, {.i = mousescrollincrement} }, + }; + + /* Internal keyboard shortcuts. */ +-- +2.22.0 diff --git a/patches/st-spoiler-20180309-c5ba9c0.diff b/patches/st-spoiler-20180309-c5ba9c0.diff @@ -0,0 +1,21 @@ +diff --git a/x.c b/x.c +--- a/x.c ++++ b/x.c +@@ -1330,9 +1330,14 @@ xdrawglyphfontspecs(const XftGlyphFontSpec *specs, Glyph base, int len, int x, i + } + + if (base.mode & ATTR_REVERSE) { +- temp = fg; +- fg = bg; +- bg = temp; ++ if (bg == fg) { ++ bg = &dc.col[defaultfg]; ++ fg = &dc.col[defaultbg]; ++ } else { ++ temp = fg; ++ fg = bg; ++ bg = temp; ++ } + } + + if (base.mode & ATTR_BLINK && win.mode & MODE_BLINK) diff --git a/patches/st-swapmouse-0.8.4.diff b/patches/st-swapmouse-0.8.4.diff @@ -0,0 +1,37 @@ +diff -up st-0.8.4-ori/x.c st-0.8.4/x.c +--- st-0.8.4-ori/x.c 2020-06-19 14:59:45.000000000 +0530 ++++ st-0.8.4/x.c 2020-07-20 03:39:56.260922736 +0530 +@@ -254,6 +254,9 @@ static char *opt_title = NULL; + + static int oldbutton = 3; /* button event on startup: 3 = release */ + ++static Cursor cursor; ++static XColor xmousefg, xmousebg; ++ + void + clipcopy(const Arg *dummy) + { +@@ -1099,10 +1102,8 @@ void + xinit(int cols, int rows) + { + XGCValues gcvalues; +- Cursor cursor; + Window parent; + pid_t thispid = getpid(); +- XColor xmousefg, xmousebg; + + if (!(xw.dpy = XOpenDisplay(NULL))) + die("can't open display\n"); +@@ -1683,6 +1684,12 @@ xsetmode(int set, unsigned int flags) + { + int mode = win.mode; + MODBIT(win.mode, set, flags); ++ if (flags & MODE_MOUSE) { ++ if (win.mode & MODE_MOUSE) ++ XUndefineCursor(xw.dpy, xw.win); ++ else ++ XDefineCursor(xw.dpy, xw.win, cursor); ++ } + if ((win.mode & MODE_REVERSE) != (mode & MODE_REVERSE)) + redraw(); + }