sites

public wiki contents of suckless.org
git clone git://git.suckless.org/sites
Log | Files | Refs

commit e4f42616e953ded8adddf4c06297f913f3ece69c
parent 68d6e0316208f1462b9352839a4fd6888cf9ba1a
Author: FRIGN <dev@frign.de>
Date:   Thu, 16 Jun 2016 17:40:27 +0200

Update st git-patches

I wrote a simple script which does that automatically now. This will
ensure that the st-patches remain current.

Diffstat:
Mst.suckless.org/patches/argbbg.md | 4++--
Mst.suckless.org/patches/clipboard.md | 4++--
Mst.suckless.org/patches/copyurl.md | 5++---
Mst.suckless.org/patches/delkey.md | 4++--
Mst.suckless.org/patches/externalpipe.md | 4++--
Mst.suckless.org/patches/hidecursor.md | 4++--
Mst.suckless.org/patches/openbsd.md | 4++--
Mst.suckless.org/patches/scrollback.md | 12++++++------
Mst.suckless.org/patches/solarized.md | 8++++----
Mst.suckless.org/patches/spoiler.md | 3++-
Dst.suckless.org/patches/st-argbbg-git-20160425.diff | 188-------------------------------------------------------------------------------
Ast.suckless.org/patches/st-argbbg-git-20160616.diff | 188+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Dst.suckless.org/patches/st-clipboard-git-20150917.diff | 13-------------
Ast.suckless.org/patches/st-clipboard-git-20160616.diff | 13+++++++++++++
Dst.suckless.org/patches/st-copyurl-git-20160210.diff | 88-------------------------------------------------------------------------------
Ast.suckless.org/patches/st-copyurl-git-20160616.diff | 88+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Dst.suckless.org/patches/st-delkey-git-20150917.diff | 45---------------------------------------------
Ast.suckless.org/patches/st-delkey-git-20160616.diff | 45+++++++++++++++++++++++++++++++++++++++++++++
Dst.suckless.org/patches/st-externalpipe-git-20160204.diff | 75---------------------------------------------------------------------------
Ast.suckless.org/patches/st-externalpipe-git-20160616.diff | 75+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Dst.suckless.org/patches/st-hidecursor-git-20150917.diff | 88-------------------------------------------------------------------------------
Ast.suckless.org/patches/st-hidecursor-git-20160616.diff | 88+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Dst.suckless.org/patches/st-no_bold_colors-git-20150917.diff | 13-------------
Ast.suckless.org/patches/st-no_bold_colors-git-20160616.diff | 13+++++++++++++
Dst.suckless.org/patches/st-openbsd-git-20150920.diff | 27---------------------------
Ast.suckless.org/patches/st-openbsd-git-20160616.diff | 27+++++++++++++++++++++++++++
Dst.suckless.org/patches/st-scrollback-git-20160425.diff | 387-------------------------------------------------------------------------------
Ast.suckless.org/patches/st-scrollback-git-20160616.diff | 387+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Dst.suckless.org/patches/st-scrollback-mouse-altscreen-git-20160203.diff | 40----------------------------------------
Ast.suckless.org/patches/st-scrollback-mouse-altscreen-git-20160616.diff | 25+++++++++++++++++++++++++
Dst.suckless.org/patches/st-scrollback-mouse-git-20151106.diff | 62--------------------------------------------------------------
Ast.suckless.org/patches/st-scrollback-mouse-git-20160616.diff | 62++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Dst.suckless.org/patches/st-solarized-dark-git-20151119.diff | 68--------------------------------------------------------------------
Ast.suckless.org/patches/st-solarized-dark-git-20160616.diff | 68++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Dst.suckless.org/patches/st-solarized-light-git-20151119.diff | 68--------------------------------------------------------------------
Ast.suckless.org/patches/st-solarized-light-git-20160616.diff | 68++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Dst.suckless.org/patches/st-spoiler-git-20150922.diff | 22----------------------
Ast.suckless.org/patches/st-spoiler-git-20160616.diff | 22++++++++++++++++++++++
Dst.suckless.org/patches/st-visualbell-git-20160209.diff | 42------------------------------------------
Ast.suckless.org/patches/st-visualbell-git-20160616.diff | 42++++++++++++++++++++++++++++++++++++++++++
Mst.suckless.org/patches/visualbell.md | 3++-
41 files changed, 1239 insertions(+), 1253 deletions(-)

diff --git a/st.suckless.org/patches/argbbg.md b/st.suckless.org/patches/argbbg.md @@ -17,10 +17,10 @@ make this patch effective. * [st-argbbg-0.4.1.diff](st-argbbg-0.4.1.diff) * [st-argbbg-0.5.diff](st-argbbg-0.5.diff) * [st-argbbg-0.6.diff](st-argbbg-0.6.diff) - * [st-argbbg-git-20160425.diff](st-argbbg-git-20160425.diff) + * [st-argbbg-git-20160616.diff](st-argbbg-git-20160616.diff) ## Authors ## * Eon S. Jeon - esjeon@hyunmu.am * pr - protodev@gmx.net (0.5 port) * Laslo Hunhold - dev@frign.de (0.6 port) - * David Phillips - dbphillipsnz@gmail.com (git-20160425 port) + * David Phillips - dbphillipsnz@gmail.com (git port) diff --git a/st.suckless.org/patches/clipboard.md b/st.suckless.org/patches/clipboard.md @@ -13,9 +13,9 @@ CLIPBOARD. ## Download * [st-clipboard-0.6.diff](st-clipboard-0.6.diff) -* [st-clipboard-git-20150917.diff](st-clipboard-git-20150917.diff) +* [st-clipboard-git-20160616.diff](st-clipboard-git-20160616.diff) ## Authors * Kai Hendry - hendry@iki.fi - * Laslo Hunhold - dev@frign.de (git-20150917 port) + * Laslo Hunhold - dev@frign.de (git port) diff --git a/st.suckless.org/patches/copyurl.md b/st.suckless.org/patches/copyurl.md @@ -17,11 +17,10 @@ Download -------- * [st-copyurl-0.6.diff](st-copyurl-0.6.diff) - * [st-copyurl-git-20160210.diff](st-copyurl-git-20160210.diff) + * [st-copyurl-git-20160616.diff](st-copyurl-git-20160616.diff) Authors ------- * Brandon Mulcahy - brandon@jangler.info - * Laslo Hunhold - dev@frign.de (0.6 port) - * David Phillips - dbphillipsnz@gmail.com (git-20160210 port) + * Laslo Hunhold - dev@frign.de (0.6, git ports) diff --git a/st.suckless.org/patches/delkey.md b/st.suckless.org/patches/delkey.md @@ -10,10 +10,10 @@ Download -------- * [st-delkey-0.6.diff](st-delkey-0.6.diff) - * [st-delkey-git-20150917.diff](st-delkey-git-20150917.diff) + * [st-delkey-git-20160616.diff](st-delkey-git-20160616.diff) Authors ------- * Roberto E. Vargas Caballero - k0ga@shike2.com - * Laslo Hunhold - dev@frign.de (0.6, git-20150917 ports) + * Laslo Hunhold - dev@frign.de (0.6, git ports) diff --git a/st.suckless.org/patches/externalpipe.md b/st.suckless.org/patches/externalpipe.md @@ -27,10 +27,10 @@ Download * [st-externalpipe-0.4.1.diff](st-externalpipe-0.4.1.diff) * [st-externalpipe-0.5.diff](st-externalpipe-0.5.diff) * [st-externalpipe-0.6.diff](st-externalpipe-0.6.diff) -* [st-externalpipe-git-20160204.diff](st-externalpipe-git-20160204.diff) +* [st-externalpipe-git-20160616.diff](st-externalpipe-git-20160616.diff) Authors ------- * Rob Pilling - robpilling@gmail.com - * Laslo Hunhold - dev@frign.de (0.4.1, 0.5, 0.6, git-20150917 ports) + * Laslo Hunhold - dev@frign.de (0.4.1, 0.5, 0.6, git ports) diff --git a/st.suckless.org/patches/hidecursor.md b/st.suckless.org/patches/hidecursor.md @@ -12,10 +12,10 @@ Download * [st-hidecursor-0.5.diff](st-hidecursor-0.5.diff) * [st-hidecursor-0.6.diff](st-hidecursor-0.6.diff) -* [st-hidecursor-git-20150917.diff](st-hidecursor-git-20150917.diff) +* [st-hidecursor-git-20160616.diff](st-hidecursor-git-20160616.diff) Authors ------- * Ivan Delalande - colona@ycc.fr - * Laslo Hunhold - dev@frign.de (git-20150917 port) + * Laslo Hunhold - dev@frign.de (git port) diff --git a/st.suckless.org/patches/openbsd.md b/st.suckless.org/patches/openbsd.md @@ -27,11 +27,11 @@ More information on this issue can be found in this Download -------- -* [st-openbsd-git-20150920.diff](st-openbsd-git-20150920.diff) +* [st-openbsd-git-20160616.diff](st-openbsd-git-20160616.diff) Authors ------- * Nils Reuße - nilsreusse@gmail.com - * Laslo Hunhold - dev@frign.de (git-20150920 port) + * Laslo Hunhold - dev@frign.de (git port) diff --git a/st.suckless.org/patches/scrollback.md b/st.suckless.org/patches/scrollback.md @@ -9,12 +9,12 @@ Scroll back through terminal output using Shift+{PageUp, PageDown}. Download -------- -* [st-scrollback-git-20160425.diff](st-scrollback-git-20160425.diff) +* [st-scrollback-git-20160616.diff](st-scrollback-git-20160616.diff) Apply the following patch on top of the previous to allow scrolling using `Shift+MouseWheel`. -* [st-scrollback-mouse-git-20151106.diff](st-scrollback-mouse-git-20151106.diff) +* [st-scrollback-mouse-git-20160616.diff](st-scrollback-mouse-git-20160616.diff) Apply the following patch on top of the previous two to allow scrollback using mouse wheel only when not in `MODE_ALTSCREEN`. eg. The content is being @@ -22,14 +22,14 @@ scrolled instead of the scrollback buffer in `less`. Consequently the Shift modifier for scrolling is not needed anymore. **Note: It might break other mkeys excluding scrolling functions.** -* [st-scrollback-mouse-altscreen-git-20160203.diff](st-scrollback-mouse-altscreen-git-20160203.diff) +* [st-scrollback-mouse-altscreen-git-20160616.diff](st-scrollback-mouse-altscreen-git-20160616.diff) Authors ------- * Jochen Sprickerhof - dwm@jochen.sprickerhof.de * M Farkas-Dyck - strake888@gmail.com - * Ivan Tham - pickfire@riseup.net (mouse scrolling, git-20151122 port) - * Laslo Hunhold - dev@frign.de (unscrambling, git-20151106 port) - * Ori Bernstein - ori@eigenstate.org (fix memory bug, git-20151216 port) + * Ivan Tham - pickfire@riseup.net (mouse scrolling) + * Laslo Hunhold - dev@frign.de (unscrambling, git port) + * Ori Bernstein - ori@eigenstate.org (fix memory bug) * Matthias Schoth - mschoth@gmail.com (auto altscreen scrolling) diff --git a/st.suckless.org/patches/solarized.md b/st.suckless.org/patches/solarized.md @@ -34,7 +34,7 @@ to disable lighting up bold colors. * [st-no_bold_colors-0.5.diff](st-no_bold_colors-0.5.diff) * [st-no_bold_colors-0.6.diff](st-no_bold_colors-0.6.diff) - * [st-no_bold_colors-git-20150917.diff](st-no_bold_colors-git-20150917.diff) + * [st-no_bold_colors-git-20160616.diff](st-no_bold_colors-git-20160616.diff) Choose one of the following patches to get either the light or the dark color scheme: @@ -43,16 +43,16 @@ or the dark color scheme: * [st-solarized-light-0.5.diff](st-solarized-light-0.5.diff) * [st-solarized-light-0.6.diff](st-solarized-light-0.6.diff) - * [st-solarized-light-git-20151119.diff](st-solarized-light-git-20151119.diff) + * [st-solarized-light-git-20160616.diff](st-solarized-light-git-20160616.diff) *Dark*: * [st-solarized-dark-0.5.diff](st-solarized-dark-0.5.diff) * [st-solarized-dark-0.6.diff](st-solarized-dark-0.6.diff) - * [st-solarized-dark-git-20151119.diff](st-solarized-dark-git-20151119.diff) + * [st-solarized-dark-git-20160616.diff](st-solarized-dark-git-20160616.diff) Authors ------- * Nils Reuße - nilsreusse@gmail.com - * Laslo Hunhold - dev@frign.de (0.5, 0.6, git-20150917 ports) + * Laslo Hunhold - dev@frign.de (0.5, 0.6, git ports) diff --git a/st.suckless.org/patches/spoiler.md b/st.suckless.org/patches/spoiler.md @@ -20,9 +20,10 @@ Download -------- * [st-spoiler-0.6.diff](st-spoiler-0.6.diff) - * [st-spoiler-git-20150922.diff](st-spoiler-git-20150922.diff) + * [st-spoiler-git-20160616.diff](st-spoiler-git-20160616.diff) Author ------ * dequis - dx@dxzone.com.ar + * Laslo Hunhold - dev@frign.de (git port) diff --git a/st.suckless.org/patches/st-argbbg-git-20160425.diff b/st.suckless.org/patches/st-argbbg-git-20160425.diff @@ -1,188 +0,0 @@ -diff --git a/config.def.h b/config.def.h -index 9e61010..2ab4f57 100644 ---- a/config.def.h -+++ b/config.def.h -@@ -67,6 +67,9 @@ static char termname[] = "st-256color"; - - static unsigned int tabspaces = 8; - -+/* bg opacity */ -+static const int alpha = 0xdd; -+ - /* Terminal colors (16 first used in escape sequence) */ - static const char *colorname[] = { - /* 8 normal colors */ -@@ -94,6 +97,7 @@ static const char *colorname[] = { - /* more colors can be added after 255 to use with DefaultXX */ - "#cccccc", - "#555555", -+ "black", - }; - - -@@ -102,7 +106,7 @@ static const char *colorname[] = { - * foreground, background, cursor, reverse cursor - */ - static unsigned int defaultfg = 7; --static unsigned int defaultbg = 0; -+static unsigned int defaultbg = 257; - static unsigned int defaultcs = 256; - static unsigned int defaultrcs = 257; - -diff --git a/config.mk b/config.mk -index 81e3e47..005b1c6 100644 ---- a/config.mk -+++ b/config.mk -@@ -14,7 +14,7 @@ X11LIB = /usr/X11R6/lib - INCS = -I. -I/usr/include -I${X11INC} \ - `pkg-config --cflags fontconfig` \ - `pkg-config --cflags freetype2` --LIBS = -L/usr/lib -lc -L${X11LIB} -lm -lrt -lX11 -lutil -lXft \ -+LIBS = -L/usr/lib -lc -L${X11LIB} -lm -lrt -lX11 -lutil -lXext -lXft -lXrender\ - `pkg-config --libs fontconfig` \ - `pkg-config --libs freetype2` - -diff --git a/st.c b/st.c -index 27536d2..d8961fd 100644 ---- a/st.c -+++ b/st.c -@@ -61,6 +61,7 @@ char *argv0; - #define XK_ANY_MOD UINT_MAX - #define XK_NO_MOD 0 - #define XK_SWITCH_MOD (1<<13) -+#define OPAQUE 0Xff - - /* macros */ - #define MIN(a, b) ((a) < (b) ? (a) : (b)) -@@ -81,6 +82,8 @@ char *argv0; - (t1.tv_nsec-t2.tv_nsec)/1E6) - #define MODBIT(x, set, bit) ((set) ? ((x) |= (bit)) : ((x) &= ~(bit))) - -+#define USE_ARGB (alpha != OPAQUE && opt_embed == NULL) -+ - #define TRUECOLOR(r,g,b) (1 << 24 | (r) << 16 | (g) << 8 | (b)) - #define IS_TRUECOL(x) (1 << 24 & (x)) - #define TRUERED(x) (((x) & 0xff0000) >> 8) -@@ -268,6 +271,7 @@ typedef struct { - int w, h; /* window width and height */ - int ch; /* char height */ - int cw; /* char width */ -+ int depth; /* bit depth */ - char state; /* focus, redraw, visible */ - int cursor; /* cursor style */ - } XWindow; -@@ -3138,7 +3142,7 @@ xresize(int col, int row) - - XFreePixmap(xw.dpy, xw.buf); - xw.buf = XCreatePixmap(xw.dpy, xw.win, xw.w, xw.h, -- DefaultDepth(xw.dpy, xw.scr)); -+ xw.depth); - XftDrawChange(xw.draw, xw.buf); - xclear(0, 0, xw.w, xw.h); - } -@@ -3192,6 +3196,14 @@ xloadcols(void) - else - die("Could not allocate color %d\n", i); - } -+ -+ /* set alpha value of bg color */ -+ if (USE_ARGB) { -+ dc.col[defaultbg].color.alpha = (0xffff * alpha) / OPAQUE; //0xcccc; -+ dc.col[defaultbg].pixel &= 0x00111111; -+ dc.col[defaultbg].pixel |= alpha << 24; // 0xcc000000; -+ } -+ - loaded = 1; - } - -@@ -3213,6 +3225,16 @@ xsetcolorname(int x, const char *name) - return 0; - } - -+void -+xtermclear(int col1, int row1, int col2, int row2) { -+ XftDrawRect(xw.draw, -+ &dc.col[IS_SET(MODE_REVERSE) ? defaultfg : defaultbg], -+ borderpx + col1 * xw.cw, -+ borderpx + row1 * xw.ch, -+ (col2-col1+1) * xw.cw, -+ (row2-row1+1) * xw.ch); -+} -+ - /* - * Absolute coordinates. - */ -@@ -3447,7 +3469,38 @@ xinit(void) - if (!(xw.dpy = XOpenDisplay(NULL))) - die("Can't open display\n"); - xw.scr = XDefaultScreen(xw.dpy); -- xw.vis = XDefaultVisual(xw.dpy, xw.scr); -+ xw.depth = (USE_ARGB) ? 32: XDefaultDepth(xw.dpy, xw.scr); -+ if (! USE_ARGB) -+ xw.vis = XDefaultVisual(xw.dpy, xw.scr); -+ else { -+ XVisualInfo *vis; -+ XRenderPictFormat *fmt; -+ int nvi; -+ int i; -+ -+ XVisualInfo tpl = { -+ .screen = xw.scr, -+ .depth = 32, -+ .class = TrueColor -+ }; -+ -+ vis = XGetVisualInfo(xw.dpy, VisualScreenMask | VisualDepthMask | VisualClassMask, &tpl, &nvi); -+ xw.vis = NULL; -+ for(i = 0; i < nvi; i ++) { -+ fmt = XRenderFindVisualFormat(xw.dpy, vis[i].visual); -+ if (fmt->type == PictTypeDirect && fmt->direct.alphaMask) { -+ xw.vis = vis[i].visual; -+ break; -+ } -+ } -+ -+ XFree(vis); -+ -+ if (! xw.vis) { -+ fprintf(stderr, "Couldn't find ARGB visual.\n"); -+ exit(1); -+ } -+ } - - /* font */ - if (!FcInit()) -@@ -3457,7 +3510,10 @@ xinit(void) - xloadfonts(usedfont, 0); - - /* colors */ -- xw.cmap = XDefaultColormap(xw.dpy, xw.scr); -+ if (! USE_ARGB) -+ xw.cmap = XDefaultColormap(xw.dpy, xw.scr); -+ else -+ xw.cmap = XCreateColormap(xw.dpy, XRootWindow(xw.dpy, xw.scr), xw.vis, None); - xloadcols(); - - /* adjust fixed window geometry */ -@@ -3480,16 +3536,17 @@ xinit(void) - if (!(opt_embed && (parent = strtol(opt_embed, NULL, 0)))) - parent = XRootWindow(xw.dpy, xw.scr); - xw.win = XCreateWindow(xw.dpy, parent, xw.l, xw.t, -- xw.w, xw.h, 0, XDefaultDepth(xw.dpy, xw.scr), InputOutput, -+ xw.w, xw.h, 0, xw.depth, InputOutput, - xw.vis, CWBackPixel | CWBorderPixel | CWBitGravity - | CWEventMask | CWColormap, &xw.attrs); - - memset(&gcvalues, 0, sizeof(gcvalues)); - gcvalues.graphics_exposures = False; -- dc.gc = XCreateGC(xw.dpy, parent, GCGraphicsExposures, -+ xw.buf = XCreatePixmap(xw.dpy, xw.win, xw.w, xw.h, xw.depth); -+ dc.gc = XCreateGC(xw.dpy, -+ (USE_ARGB)? xw.buf: parent, -+ GCGraphicsExposures, - &gcvalues); -- xw.buf = XCreatePixmap(xw.dpy, xw.win, xw.w, xw.h, -- DefaultDepth(xw.dpy, xw.scr)); - XSetForeground(xw.dpy, dc.gc, dc.col[defaultbg].pixel); - XFillRectangle(xw.dpy, xw.buf, dc.gc, 0, 0, xw.w, xw.h); - diff --git a/st.suckless.org/patches/st-argbbg-git-20160616.diff b/st.suckless.org/patches/st-argbbg-git-20160616.diff @@ -0,0 +1,188 @@ +diff --git a/config.def.h b/config.def.h +index 9e61010..2ab4f57 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -67,6 +67,9 @@ static char termname[] = "st-256color"; + + static unsigned int tabspaces = 8; + ++/* bg opacity */ ++static const int alpha = 0xdd; ++ + /* Terminal colors (16 first used in escape sequence) */ + static const char *colorname[] = { + /* 8 normal colors */ +@@ -94,6 +97,7 @@ static const char *colorname[] = { + /* more colors can be added after 255 to use with DefaultXX */ + "#cccccc", + "#555555", ++ "black", + }; + + +@@ -102,7 +106,7 @@ static const char *colorname[] = { + * foreground, background, cursor, reverse cursor + */ + static unsigned int defaultfg = 7; +-static unsigned int defaultbg = 0; ++static unsigned int defaultbg = 257; + static unsigned int defaultcs = 256; + static unsigned int defaultrcs = 257; + +diff --git a/config.mk b/config.mk +index 81e3e47..005b1c6 100644 +--- a/config.mk ++++ b/config.mk +@@ -14,7 +14,7 @@ X11LIB = /usr/X11R6/lib + INCS = -I. -I/usr/include -I${X11INC} \ + `pkg-config --cflags fontconfig` \ + `pkg-config --cflags freetype2` +-LIBS = -L/usr/lib -lc -L${X11LIB} -lm -lrt -lX11 -lutil -lXft \ ++LIBS = -L/usr/lib -lc -L${X11LIB} -lm -lrt -lX11 -lutil -lXext -lXft -lXrender\ + `pkg-config --libs fontconfig` \ + `pkg-config --libs freetype2` + +diff --git a/st.c b/st.c +index 2594c65..f9ba75b 100644 +--- a/st.c ++++ b/st.c +@@ -61,6 +61,7 @@ char *argv0; + #define XK_ANY_MOD UINT_MAX + #define XK_NO_MOD 0 + #define XK_SWITCH_MOD (1<<13) ++#define OPAQUE 0Xff + + /* macros */ + #define MIN(a, b) ((a) < (b) ? (a) : (b)) +@@ -81,6 +82,8 @@ char *argv0; + (t1.tv_nsec-t2.tv_nsec)/1E6) + #define MODBIT(x, set, bit) ((set) ? ((x) |= (bit)) : ((x) &= ~(bit))) + ++#define USE_ARGB (alpha != OPAQUE && opt_embed == NULL) ++ + #define TRUECOLOR(r,g,b) (1 << 24 | (r) << 16 | (g) << 8 | (b)) + #define IS_TRUECOL(x) (1 << 24 & (x)) + #define TRUERED(x) (((x) & 0xff0000) >> 8) +@@ -268,6 +271,7 @@ typedef struct { + int w, h; /* window width and height */ + int ch; /* char height */ + int cw; /* char width */ ++ int depth; /* bit depth */ + char state; /* focus, redraw, visible */ + int cursor; /* cursor style */ + } XWindow; +@@ -3137,7 +3141,7 @@ xresize(int col, int row) + + XFreePixmap(xw.dpy, xw.buf); + xw.buf = XCreatePixmap(xw.dpy, xw.win, xw.w, xw.h, +- DefaultDepth(xw.dpy, xw.scr)); ++ xw.depth); + XftDrawChange(xw.draw, xw.buf); + xclear(0, 0, xw.w, xw.h); + } +@@ -3191,6 +3195,14 @@ xloadcols(void) + else + die("Could not allocate color %d\n", i); + } ++ ++ /* set alpha value of bg color */ ++ if (USE_ARGB) { ++ dc.col[defaultbg].color.alpha = (0xffff * alpha) / OPAQUE; //0xcccc; ++ dc.col[defaultbg].pixel &= 0x00111111; ++ dc.col[defaultbg].pixel |= alpha << 24; // 0xcc000000; ++ } ++ + loaded = 1; + } + +@@ -3212,6 +3224,16 @@ xsetcolorname(int x, const char *name) + return 0; + } + ++void ++xtermclear(int col1, int row1, int col2, int row2) { ++ XftDrawRect(xw.draw, ++ &dc.col[IS_SET(MODE_REVERSE) ? defaultfg : defaultbg], ++ borderpx + col1 * xw.cw, ++ borderpx + row1 * xw.ch, ++ (col2-col1+1) * xw.cw, ++ (row2-row1+1) * xw.ch); ++} ++ + /* + * Absolute coordinates. + */ +@@ -3443,7 +3465,38 @@ xinit(void) + if (!(xw.dpy = XOpenDisplay(NULL))) + die("Can't open display\n"); + xw.scr = XDefaultScreen(xw.dpy); +- xw.vis = XDefaultVisual(xw.dpy, xw.scr); ++ xw.depth = (USE_ARGB) ? 32: XDefaultDepth(xw.dpy, xw.scr); ++ if (! USE_ARGB) ++ xw.vis = XDefaultVisual(xw.dpy, xw.scr); ++ else { ++ XVisualInfo *vis; ++ XRenderPictFormat *fmt; ++ int nvi; ++ int i; ++ ++ XVisualInfo tpl = { ++ .screen = xw.scr, ++ .depth = 32, ++ .class = TrueColor ++ }; ++ ++ vis = XGetVisualInfo(xw.dpy, VisualScreenMask | VisualDepthMask | VisualClassMask, &tpl, &nvi); ++ xw.vis = NULL; ++ for(i = 0; i < nvi; i ++) { ++ fmt = XRenderFindVisualFormat(xw.dpy, vis[i].visual); ++ if (fmt->type == PictTypeDirect && fmt->direct.alphaMask) { ++ xw.vis = vis[i].visual; ++ break; ++ } ++ } ++ ++ XFree(vis); ++ ++ if (! xw.vis) { ++ fprintf(stderr, "Couldn't find ARGB visual.\n"); ++ exit(1); ++ } ++ } + + /* font */ + if (!FcInit()) +@@ -3453,7 +3506,10 @@ xinit(void) + xloadfonts(usedfont, 0); + + /* colors */ +- xw.cmap = XDefaultColormap(xw.dpy, xw.scr); ++ if (! USE_ARGB) ++ xw.cmap = XDefaultColormap(xw.dpy, xw.scr); ++ else ++ xw.cmap = XCreateColormap(xw.dpy, XRootWindow(xw.dpy, xw.scr), xw.vis, None); + xloadcols(); + + /* adjust fixed window geometry */ +@@ -3476,16 +3532,17 @@ xinit(void) + if (!(opt_embed && (parent = strtol(opt_embed, NULL, 0)))) + parent = XRootWindow(xw.dpy, xw.scr); + xw.win = XCreateWindow(xw.dpy, parent, xw.l, xw.t, +- xw.w, xw.h, 0, XDefaultDepth(xw.dpy, xw.scr), InputOutput, ++ xw.w, xw.h, 0, xw.depth, InputOutput, + xw.vis, CWBackPixel | CWBorderPixel | CWBitGravity + | CWEventMask | CWColormap, &xw.attrs); + + memset(&gcvalues, 0, sizeof(gcvalues)); + gcvalues.graphics_exposures = False; +- dc.gc = XCreateGC(xw.dpy, parent, GCGraphicsExposures, ++ xw.buf = XCreatePixmap(xw.dpy, xw.win, xw.w, xw.h, xw.depth); ++ dc.gc = XCreateGC(xw.dpy, ++ (USE_ARGB)? xw.buf: parent, ++ GCGraphicsExposures, + &gcvalues); +- xw.buf = XCreatePixmap(xw.dpy, xw.win, xw.w, xw.h, +- DefaultDepth(xw.dpy, xw.scr)); + XSetForeground(xw.dpy, dc.gc, dc.col[defaultbg].pixel); + XFillRectangle(xw.dpy, xw.buf, dc.gc, 0, 0, xw.w, xw.h); + diff --git a/st.suckless.org/patches/st-clipboard-git-20150917.diff b/st.suckless.org/patches/st-clipboard-git-20150917.diff @@ -1,13 +0,0 @@ -diff --git a/st.c b/st.c -index bd8b815..73c4573 100644 ---- a/st.c -+++ b/st.c -@@ -1262,6 +1262,8 @@ xsetsel(char *str, Time t) - XSetSelectionOwner(xw.dpy, XA_PRIMARY, xw.win, t); - if (XGetSelectionOwner(xw.dpy, XA_PRIMARY) != xw.win) - selclear(0); -+ -+ clipcopy(NULL); - } - - void diff --git a/st.suckless.org/patches/st-clipboard-git-20160616.diff b/st.suckless.org/patches/st-clipboard-git-20160616.diff @@ -0,0 +1,13 @@ +diff --git a/st.c b/st.c +index 2594c65..ebdde9f 100644 +--- a/st.c ++++ b/st.c +@@ -1263,6 +1263,8 @@ xsetsel(char *str, Time t) + XSetSelectionOwner(xw.dpy, XA_PRIMARY, xw.win, t); + if (XGetSelectionOwner(xw.dpy, XA_PRIMARY) != xw.win) + selclear(0); ++ ++ clipcopy(NULL); + } + + void diff --git a/st.suckless.org/patches/st-copyurl-git-20160210.diff b/st.suckless.org/patches/st-copyurl-git-20160210.diff @@ -1,88 +0,0 @@ -diff --git a/config.def.h b/config.def.h -index fd09d72..05fbba5 100644 ---- a/config.def.h -+++ b/config.def.h -@@ -157,6 +157,7 @@ static Shortcut shortcuts[] = { - { MODKEY|ShiftMask, XK_C, clipcopy, {.i = 0} }, - { MODKEY|ShiftMask, XK_V, clippaste, {.i = 0} }, - { MODKEY, XK_Num_Lock, numlock, {.i = 0} }, -+ { MODKEY, XK_l, copyurl, {.i = 0} }, - }; - - /* -diff --git a/st.c b/st.c -index 41f6942..aa5ed41 100644 ---- a/st.c -+++ b/st.c -@@ -335,6 +335,7 @@ static void printsel(const Arg *); - static void printscreen(const Arg *) ; - static void toggleprinter(const Arg *); - static void sendbreak(const Arg *); -+static void copyurl(const Arg *); - - /* Config.h for applying patches and the configuration. */ - #include "config.h" -@@ -4411,3 +4412,63 @@ run: - return 0; - } - -+/* select and copy the previous url on screen (do nothing if there's no url). -+ * known bug: doesn't handle urls that span multiple lines (wontfix) -+ * known bug: only finds first url on line (mightfix) -+ */ -+void -+copyurl(const Arg *arg) { -+ /* () and [] can appear in urls, but excluding them here will reduce false -+ * positives when figuring out where a given url ends. -+ */ -+ static char URLCHARS[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" -+ "abcdefghijklmnopqrstuvwxyz" -+ "0123456789-._~:/?#@!$&'*+,;=%"; -+ -+ int i, row, startrow; -+ char *linestr = calloc(sizeof(char), term.col+1); /* assume ascii */ -+ char *c, *match = NULL; -+ -+ row = (sel.ob.x >= 0 && sel.nb.y > 0) ? sel.nb.y-1 : term.bot; -+ LIMIT(row, term.top, term.bot); -+ startrow = row; -+ -+ /* find the start of the last url before selection */ -+ do { -+ for (i = 0; i < term.col; ++i) { -+ if (term.line[row][i].u > 127) /* assume ascii */ -+ continue; -+ linestr[i] = term.line[row][i].u; -+ } -+ linestr[term.col] = '\0'; -+ if ((match = strstr(linestr, "http://")) -+ || (match = strstr(linestr, "https://"))) -+ break; -+ if (--row < term.top) -+ row = term.bot; -+ } while (row != startrow); -+ -+ if (match) { -+ /* must happen before trim */ -+ selclear(NULL); -+ sel.ob.x = strlen(linestr) - strlen(match); -+ -+ /* trim the rest of the line from the url match */ -+ for (c = match; *c != '\0'; ++c) -+ if (!strchr(URLCHARS, *c)) { -+ *c = '\0'; -+ break; -+ } -+ -+ /* select and copy */ -+ sel.mode = 1; -+ sel.type = SEL_REGULAR; -+ sel.oe.x = sel.ob.x + strlen(match)-1; -+ sel.ob.y = sel.oe.y = row; -+ selnormalize(); -+ tsetdirt(sel.nb.y, sel.ne.y); -+ selcopy(0); -+ } -+ -+ free(linestr); -+} diff --git a/st.suckless.org/patches/st-copyurl-git-20160616.diff b/st.suckless.org/patches/st-copyurl-git-20160616.diff @@ -0,0 +1,88 @@ +diff --git a/config.def.h b/config.def.h +index 9e61010..c88bb0b 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -157,6 +157,7 @@ static Shortcut shortcuts[] = { + { MODKEY|ShiftMask, XK_C, clipcopy, {.i = 0} }, + { MODKEY|ShiftMask, XK_V, clippaste, {.i = 0} }, + { MODKEY, XK_Num_Lock, numlock, {.i = 0} }, ++ { MODKEY, XK_l, copyurl, {.i = 0} }, + }; + + /* +diff --git a/st.c b/st.c +index 2594c65..78201ff 100644 +--- a/st.c ++++ b/st.c +@@ -336,6 +336,7 @@ static void printsel(const Arg *); + static void printscreen(const Arg *) ; + static void toggleprinter(const Arg *); + static void sendbreak(const Arg *); ++static void copyurl(const Arg *); + + /* Config.h for applying patches and the configuration. */ + #include "config.h" +@@ -4402,3 +4403,63 @@ run: + return 0; + } + ++/* select and copy the previous url on screen (do nothing if there's no url). ++ * known bug: doesn't handle urls that span multiple lines (wontfix) ++ * known bug: only finds first url on line (mightfix) ++ */ ++void ++copyurl(const Arg *arg) { ++ /* () and [] can appear in urls, but excluding them here will reduce false ++ * positives when figuring out where a given url ends. ++ */ ++ static char URLCHARS[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" ++ "abcdefghijklmnopqrstuvwxyz" ++ "0123456789-._~:/?#@!$&'*+,;=%"; ++ ++ int i, row, startrow; ++ char *linestr = calloc(sizeof(char), term.col+1); /* assume ascii */ ++ char *c, *match = NULL; ++ ++ row = (sel.ob.x >= 0 && sel.nb.y > 0) ? sel.nb.y-1 : term.bot; ++ LIMIT(row, term.top, term.bot); ++ startrow = row; ++ ++ /* find the start of the last url before selection */ ++ do { ++ for (i = 0; i < term.col; ++i) { ++ if (term.line[row][i].u > 127) /* assume ascii */ ++ continue; ++ linestr[i] = term.line[row][i].u; ++ } ++ linestr[term.col] = '\0'; ++ if ((match = strstr(linestr, "http://")) ++ || (match = strstr(linestr, "https://"))) ++ break; ++ if (--row < term.top) ++ row = term.bot; ++ } while (row != startrow); ++ ++ if (match) { ++ /* must happen before trim */ ++ selclear(NULL); ++ sel.ob.x = strlen(linestr) - strlen(match); ++ ++ /* trim the rest of the line from the url match */ ++ for (c = match; *c != '\0'; ++c) ++ if (!strchr(URLCHARS, *c)) { ++ *c = '\0'; ++ break; ++ } ++ ++ /* select and copy */ ++ sel.mode = 1; ++ sel.type = SEL_REGULAR; ++ sel.oe.x = sel.ob.x + strlen(match)-1; ++ sel.ob.y = sel.oe.y = row; ++ selnormalize(); ++ tsetdirt(sel.nb.y, sel.ne.y); ++ selcopy(0); ++ } ++ ++ free(linestr); ++} diff --git a/st.suckless.org/patches/st-delkey-git-20150917.diff b/st.suckless.org/patches/st-delkey-git-20150917.diff @@ -1,45 +0,0 @@ -diff --git a/config.def.h b/config.def.h -index b6adc5e..ceaafa0 100644 ---- a/config.def.h -+++ b/config.def.h -@@ -238,7 +238,7 @@ static Key key[] = { - { XK_KP_Delete, ShiftMask, "\033[2K", -1, 0, 0}, - { XK_KP_Delete, ShiftMask, "\033[3;2~", +1, 0, 0}, - { XK_KP_Delete, XK_ANY_MOD, "\033[P", -1, 0, 0}, -- { XK_KP_Delete, XK_ANY_MOD, "\033[3~", +1, 0, 0}, -+ { XK_KP_Delete, XK_ANY_MOD, "\177", +1, 0, 0}, - { XK_KP_Multiply, XK_ANY_MOD, "\033Oj", +2, 0, 0}, - { XK_KP_Add, XK_ANY_MOD, "\033Ok", +2, 0, 0}, - { XK_KP_Enter, XK_ANY_MOD, "\033OM", +2, 0, 0}, -@@ -293,8 +293,7 @@ static Key key[] = { - { XK_Delete, ShiftMask, "\033[2K", -1, 0, 0}, - { XK_Delete, ShiftMask, "\033[3;2~", +1, 0, 0}, - { XK_Delete, XK_ANY_MOD, "\033[P", -1, 0, 0}, -- { XK_Delete, XK_ANY_MOD, "\033[3~", +1, 0, 0}, -- { XK_BackSpace, XK_NO_MOD, "\177", 0, 0, 0}, -+ { XK_Delete, XK_ANY_MOD, "\177", +1, 0, 0}, - { XK_Home, ShiftMask, "\033[2J", 0, -1, 0}, - { XK_Home, ShiftMask, "\033[1;2H", 0, +1, 0}, - { XK_Home, XK_ANY_MOD, "\033[H", 0, -1, 0}, -diff --git a/st.info b/st.info -index b70fefa..d979946 100644 ---- a/st.info -+++ b/st.info -@@ -53,7 +53,7 @@ st| simpleterm, - ka3=\E[5~, - kc1=\E[4~, - kc3=\E[6~, -- kbs=\177, -+ kbs=\010, - kcbt=\E[Z, - kb2=\EOu, - kcub1=\EOD, -@@ -73,7 +73,7 @@ st| simpleterm, - kri=\E[1;2A, - kclr=\E[3;5~, - kdl1=\E[3;2~, -- kdch1=\E[3~, -+ kdch1=\177~, - kich1=\E[2~, - kend=\E[4~, - kf1=\EOP, diff --git a/st.suckless.org/patches/st-delkey-git-20160616.diff b/st.suckless.org/patches/st-delkey-git-20160616.diff @@ -0,0 +1,45 @@ +diff --git a/config.def.h b/config.def.h +index 9e61010..458f397 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -246,7 +246,7 @@ static Key key[] = { + { XK_KP_Delete, ShiftMask, "\033[2K", -1, 0, 0}, + { XK_KP_Delete, ShiftMask, "\033[3;2~", +1, 0, 0}, + { XK_KP_Delete, XK_ANY_MOD, "\033[P", -1, 0, 0}, +- { XK_KP_Delete, XK_ANY_MOD, "\033[3~", +1, 0, 0}, ++ { XK_KP_Delete, XK_ANY_MOD, "\177", +1, 0, 0}, + { XK_KP_Multiply, XK_ANY_MOD, "\033Oj", +2, 0, 0}, + { XK_KP_Add, XK_ANY_MOD, "\033Ok", +2, 0, 0}, + { XK_KP_Enter, XK_ANY_MOD, "\033OM", +2, 0, 0}, +@@ -301,8 +301,7 @@ static Key key[] = { + { XK_Delete, ShiftMask, "\033[2K", -1, 0, 0}, + { XK_Delete, ShiftMask, "\033[3;2~", +1, 0, 0}, + { XK_Delete, XK_ANY_MOD, "\033[P", -1, 0, 0}, +- { XK_Delete, XK_ANY_MOD, "\033[3~", +1, 0, 0}, +- { XK_BackSpace, XK_NO_MOD, "\177", 0, 0, 0}, ++ { XK_Delete, XK_ANY_MOD, "\177", +1, 0, 0}, + { XK_Home, ShiftMask, "\033[2J", 0, -1, 0}, + { XK_Home, ShiftMask, "\033[1;2H", 0, +1, 0}, + { XK_Home, XK_ANY_MOD, "\033[H", 0, -1, 0}, +diff --git a/st.info b/st.info +index b70fefa..d979946 100644 +--- a/st.info ++++ b/st.info +@@ -53,7 +53,7 @@ st| simpleterm, + ka3=\E[5~, + kc1=\E[4~, + kc3=\E[6~, +- kbs=\177, ++ kbs=\010, + kcbt=\E[Z, + kb2=\EOu, + kcub1=\EOD, +@@ -73,7 +73,7 @@ st| simpleterm, + kri=\E[1;2A, + kclr=\E[3;5~, + kdl1=\E[3;2~, +- kdch1=\E[3~, ++ kdch1=\177~, + kich1=\E[2~, + kend=\E[4~, + kf1=\EOP, diff --git a/st.suckless.org/patches/st-externalpipe-git-20160204.diff b/st.suckless.org/patches/st-externalpipe-git-20160204.diff @@ -1,75 +0,0 @@ -diff --git a/st.c b/st.c -index 0536b6f..59f982c 100644 ---- a/st.c -+++ b/st.c -@@ -335,6 +335,7 @@ static void printsel(const Arg *); - static void printscreen(const Arg *) ; - static void toggleprinter(const Arg *); - static void sendbreak(const Arg *); -+static void externalpipe(const Arg *); - - /* Config.h for applying patches and the configuration. */ - #include "config.h" -@@ -2923,6 +2924,62 @@ eschandle(uchar ascii) - } - - void -+externalpipe(const Arg *arg) -+{ -+ int to[2]; /* 0 = read, 1 = write */ -+ pid_t child; -+ int n; -+ void (*oldsigpipe)(int); -+ char buf[UTF_SIZ]; -+ Glyph *bp, *end; -+ -+ if(pipe(to) == -1) -+ return; -+ -+ /* sigchld() handles this */ -+ switch(child = fork()){ -+ case -1: -+ close(to[0]), close(to[1]); -+ return; -+ case 0: -+ /* child */ -+ close(to[1]); -+ dup2(to[0], STDIN_FILENO); /* 0<&to */ -+ close(to[0]); -+ execvp( -+ "sh", -+ (char *const []){ -+ "/bin/sh", -+ "-c", -+ (char *)arg->v, -+ 0 -+ }); -+ exit(127); -+ } -+ -+ /* parent */ -+ close(to[0]); -+ /* ignore sigpipe for now, in case child exits early */ -+ oldsigpipe = signal(SIGPIPE, SIG_IGN); -+ -+ for(n = 0; n < term.row; n++){ -+ bp = &term.line[n][0]; -+ end = &bp[MIN(tlinelen(n), term.col) - 1]; -+ if(bp != end || bp->u != ' ') -+ for(; bp <= end; ++bp) -+ if(xwrite(to[1], buf, utf8encode(bp->u, buf)) < 0) -+ break; -+ if(xwrite(to[1], "\n", 1) < 0) -+ break; -+ } -+ -+ close(to[1]); -+ -+ /* restore */ -+ signal(SIGPIPE, oldsigpipe); -+} -+ -+void - tputc(Rune u) - { - char c[UTF_SIZ]; diff --git a/st.suckless.org/patches/st-externalpipe-git-20160616.diff b/st.suckless.org/patches/st-externalpipe-git-20160616.diff @@ -0,0 +1,75 @@ +diff --git a/st.c b/st.c +index 2594c65..1491e77 100644 +--- a/st.c ++++ b/st.c +@@ -336,6 +336,7 @@ static void printsel(const Arg *); + static void printscreen(const Arg *) ; + static void toggleprinter(const Arg *); + static void sendbreak(const Arg *); ++static void externalpipe(const Arg *); + + /* Config.h for applying patches and the configuration. */ + #include "config.h" +@@ -2922,6 +2923,62 @@ eschandle(uchar ascii) + } + + void ++externalpipe(const Arg *arg) ++{ ++ int to[2]; /* 0 = read, 1 = write */ ++ pid_t child; ++ int n; ++ void (*oldsigpipe)(int); ++ char buf[UTF_SIZ]; ++ Glyph *bp, *end; ++ ++ if(pipe(to) == -1) ++ return; ++ ++ /* sigchld() handles this */ ++ switch(child = fork()){ ++ case -1: ++ close(to[0]), close(to[1]); ++ return; ++ case 0: ++ /* child */ ++ close(to[1]); ++ dup2(to[0], STDIN_FILENO); /* 0<&to */ ++ close(to[0]); ++ execvp( ++ "sh", ++ (char *const []){ ++ "/bin/sh", ++ "-c", ++ (char *)arg->v, ++ 0 ++ }); ++ exit(127); ++ } ++ ++ /* parent */ ++ close(to[0]); ++ /* ignore sigpipe for now, in case child exits early */ ++ oldsigpipe = signal(SIGPIPE, SIG_IGN); ++ ++ for(n = 0; n < term.row; n++){ ++ bp = &term.line[n][0]; ++ end = &bp[MIN(tlinelen(n), term.col) - 1]; ++ if(bp != end || bp->u != ' ') ++ for(; bp <= end; ++bp) ++ if(xwrite(to[1], buf, utf8encode(bp->u, buf)) < 0) ++ break; ++ if(xwrite(to[1], "\n", 1) < 0) ++ break; ++ } ++ ++ close(to[1]); ++ ++ /* restore */ ++ signal(SIGPIPE, oldsigpipe); ++} ++ ++void + tputc(Rune u) + { + char c[UTF_SIZ]; diff --git a/st.suckless.org/patches/st-hidecursor-git-20150917.diff b/st.suckless.org/patches/st-hidecursor-git-20150917.diff @@ -1,88 +0,0 @@ -diff --git a/st.c b/st.c -index bd8b815..9a8e872 100644 ---- a/st.c -+++ b/st.c -@@ -259,6 +259,11 @@ typedef struct { - Draw draw; - Visual *vis; - XSetWindowAttributes attrs; -+ /* Here, we use the term *pointer* to differentiate the cursor -+ * one sees when hovering the mouse over the terminal from, e.g., -+ * a green rectangle where text would be entered. */ -+ Cursor vpointer, bpointer; /* visible and hidden pointers */ -+ int pointerisvisible; - int scr; - int isfixed; /* is fixed geometry? */ - int l, t; /* left and top offset */ -@@ -1290,6 +1295,13 @@ bmotion(XEvent *e) - { - int oldey, oldex, oldsby, oldsey; - -+ if(!xw.pointerisvisible) { -+ XDefineCursor(xw.dpy, xw.win, xw.vpointer); -+ xw.pointerisvisible = 1; -+ if(!IS_SET(MODE_MOUSEMANY)) -+ xsetpointermotion(0); -+ } -+ - if (IS_SET(MODE_MOUSE) && !(e->xbutton.state & forceselmod)) { - mousereport(e); - return; -@@ -3440,10 +3452,10 @@ void - xinit(void) - { - XGCValues gcvalues; -- Cursor cursor; - Window parent; - pid_t thispid = getpid(); - XColor xmousefg, xmousebg; -+ Pixmap blankpm; - - if (!(xw.dpy = XOpenDisplay(NULL))) - die("Can't open display\n"); -@@ -3516,8 +3528,9 @@ xinit(void) - die("XCreateIC failed. Could not obtain input method.\n"); - - /* white cursor, black outline */ -- cursor = XCreateFontCursor(xw.dpy, mouseshape); -- XDefineCursor(xw.dpy, xw.win, cursor); -+ xw.pointerisvisible = 1; -+ xw.vpointer = XCreateFontCursor(xw.dpy, mouseshape); -+ XDefineCursor(xw.dpy, xw.win, xw.vpointer); - - if (XParseColor(xw.dpy, xw.cmap, colorname[mousefg], &xmousefg) == 0) { - xmousefg.red = 0xffff; -@@ -3531,7 +3544,10 @@ xinit(void) - xmousebg.blue = 0x0000; - } - -- XRecolorCursor(xw.dpy, cursor, &xmousefg, &xmousebg); -+ XRecolorCursor(xw.dpy, xw.vpointer, &xmousefg, &xmousebg); -+ blankpm = XCreateBitmapFromData(xw.dpy, xw.win, &(char){0}, 1, 1); -+ xw.bpointer = XCreatePixmapCursor(xw.dpy, blankpm, blankpm, -+ &xmousefg, &xmousebg, 0, 0); - - xw.xembed = XInternAtom(xw.dpy, "_XEMBED", False); - xw.wmdeletewin = XInternAtom(xw.dpy, "WM_DELETE_WINDOW", False); -@@ -4006,6 +4022,8 @@ unmap(XEvent *ev) - void - xsetpointermotion(int set) - { -+ if(!set && !xw.pointerisvisible) -+ return; - MODBIT(xw.attrs.event_mask, set, PointerMotionMask); - XChangeWindowAttributes(xw.dpy, xw.win, CWEventMask, &xw.attrs); - } -@@ -4105,6 +4123,12 @@ kpress(XEvent *ev) - Status status; - Shortcut *bp; - -+ if(xw.pointerisvisible) { -+ XDefineCursor(xw.dpy, xw.win, xw.bpointer); -+ xsetpointermotion(1); -+ xw.pointerisvisible = 0; -+ } -+ - if (IS_SET(MODE_KBDLOCK)) - return; - diff --git a/st.suckless.org/patches/st-hidecursor-git-20160616.diff b/st.suckless.org/patches/st-hidecursor-git-20160616.diff @@ -0,0 +1,88 @@ +diff --git a/st.c b/st.c +index 2594c65..2a031f0 100644 +--- a/st.c ++++ b/st.c +@@ -260,6 +260,11 @@ typedef struct { + Draw draw; + Visual *vis; + XSetWindowAttributes attrs; ++ /* Here, we use the term *pointer* to differentiate the cursor ++ * one sees when hovering the mouse over the terminal from, e.g., ++ * a green rectangle where text would be entered. */ ++ Cursor vpointer, bpointer; /* visible and hidden pointers */ ++ int pointerisvisible; + int scr; + int isfixed; /* is fixed geometry? */ + int l, t; /* left and top offset */ +@@ -1291,6 +1296,13 @@ bmotion(XEvent *e) + { + int oldey, oldex, oldsby, oldsey; + ++ if(!xw.pointerisvisible) { ++ XDefineCursor(xw.dpy, xw.win, xw.vpointer); ++ xw.pointerisvisible = 1; ++ if(!IS_SET(MODE_MOUSEMANY)) ++ xsetpointermotion(0); ++ } ++ + if (IS_SET(MODE_MOUSE) && !(e->xbutton.state & forceselmod)) { + mousereport(e); + return; +@@ -3435,10 +3447,10 @@ void + xinit(void) + { + XGCValues gcvalues; +- Cursor cursor; + Window parent; + pid_t thispid = getpid(); + XColor xmousefg, xmousebg; ++ Pixmap blankpm; + + if (!(xw.dpy = XOpenDisplay(NULL))) + die("Can't open display\n"); +@@ -3511,8 +3523,9 @@ xinit(void) + die("XCreateIC failed. Could not obtain input method.\n"); + + /* white cursor, black outline */ +- cursor = XCreateFontCursor(xw.dpy, mouseshape); +- XDefineCursor(xw.dpy, xw.win, cursor); ++ xw.pointerisvisible = 1; ++ xw.vpointer = XCreateFontCursor(xw.dpy, mouseshape); ++ XDefineCursor(xw.dpy, xw.win, xw.vpointer); + + if (XParseColor(xw.dpy, xw.cmap, colorname[mousefg], &xmousefg) == 0) { + xmousefg.red = 0xffff; +@@ -3526,7 +3539,10 @@ xinit(void) + xmousebg.blue = 0x0000; + } + +- XRecolorCursor(xw.dpy, cursor, &xmousefg, &xmousebg); ++ XRecolorCursor(xw.dpy, xw.vpointer, &xmousefg, &xmousebg); ++ blankpm = XCreateBitmapFromData(xw.dpy, xw.win, &(char){0}, 1, 1); ++ xw.bpointer = XCreatePixmapCursor(xw.dpy, blankpm, blankpm, ++ &xmousefg, &xmousebg, 0, 0); + + xw.xembed = XInternAtom(xw.dpy, "_XEMBED", False); + xw.wmdeletewin = XInternAtom(xw.dpy, "WM_DELETE_WINDOW", False); +@@ -4026,6 +4042,8 @@ unmap(XEvent *ev) + void + xsetpointermotion(int set) + { ++ if(!set && !xw.pointerisvisible) ++ return; + MODBIT(xw.attrs.event_mask, set, PointerMotionMask); + XChangeWindowAttributes(xw.dpy, xw.win, CWEventMask, &xw.attrs); + } +@@ -4125,6 +4143,12 @@ kpress(XEvent *ev) + Status status; + Shortcut *bp; + ++ if(xw.pointerisvisible) { ++ XDefineCursor(xw.dpy, xw.win, xw.bpointer); ++ xsetpointermotion(1); ++ xw.pointerisvisible = 0; ++ } ++ + if (IS_SET(MODE_KBDLOCK)) + return; + diff --git a/st.suckless.org/patches/st-no_bold_colors-git-20150917.diff b/st.suckless.org/patches/st-no_bold_colors-git-20150917.diff @@ -1,13 +0,0 @@ -diff --git a/st.c b/st.c -index bd8b815..ae5a7ba 100644 ---- a/st.c -+++ b/st.c -@@ -3724,7 +3724,7 @@ xdrawglyphfontspecs(const XftGlyphFontSpec *specs, Glyph base, int len, int x, i - - /* Change basic system colors [0-7] to bright system colors [8-15] */ - if ((base.mode & ATTR_BOLD_FAINT) == ATTR_BOLD && BETWEEN(base.fg, 0, 7)) -- fg = &dc.col[base.fg + 8]; -+ fg = &dc.col[base.fg]; - - if (IS_SET(MODE_REVERSE)) { - if (fg == &dc.col[defaultfg]) { diff --git a/st.suckless.org/patches/st-no_bold_colors-git-20160616.diff b/st.suckless.org/patches/st-no_bold_colors-git-20160616.diff @@ -0,0 +1,13 @@ +diff --git a/st.c b/st.c +index 2594c65..f6fe717 100644 +--- a/st.c ++++ b/st.c +@@ -3719,7 +3719,7 @@ xdrawglyphfontspecs(const XftGlyphFontSpec *specs, Glyph base, int len, int x, i + + /* Change basic system colors [0-7] to bright system colors [8-15] */ + if ((base.mode & ATTR_BOLD_FAINT) == ATTR_BOLD && BETWEEN(base.fg, 0, 7)) +- fg = &dc.col[base.fg + 8]; ++ fg = &dc.col[base.fg]; + + if (IS_SET(MODE_REVERSE)) { + if (fg == &dc.col[defaultfg]) { diff --git a/st.suckless.org/patches/st-openbsd-git-20150920.diff b/st.suckless.org/patches/st-openbsd-git-20150920.diff @@ -1,27 +0,0 @@ -diff --git a/Makefile b/Makefile -index 6158ab2..9b81f88 100644 ---- a/Makefile -+++ b/Makefile -@@ -49,7 +49,8 @@ install: all - @sed "s/VERSION/${VERSION}/g" < st.1 > ${DESTDIR}${MANPREFIX}/man1/st.1 - @chmod 644 ${DESTDIR}${MANPREFIX}/man1/st.1 - @echo Please see the README file regarding the terminfo entry of st. -- @tic -s st.info -+ @sed 's/st\([^t].*\)/st-git\1/g' st.info > st-git.info -+ @tic -s st-git.info - - uninstall: - @echo removing executable file from ${DESTDIR}${PREFIX}/bin -diff --git a/config.def.h b/config.def.h -index b6adc5e..ffc2e74 100644 ---- a/config.def.h -+++ b/config.def.h -@@ -63,7 +63,7 @@ static unsigned int cursorthickness = 2; - static int bellvolume = 0; - - /* TERM value */ --static char termname[] = "st-256color"; -+static char termname[] = "st-git-256color"; - - static unsigned int tabspaces = 8; - diff --git a/st.suckless.org/patches/st-openbsd-git-20160616.diff b/st.suckless.org/patches/st-openbsd-git-20160616.diff @@ -0,0 +1,27 @@ +diff --git a/Makefile b/Makefile +index 6158ab2..9b81f88 100644 +--- a/Makefile ++++ b/Makefile +@@ -49,7 +49,8 @@ install: all + @sed "s/VERSION/${VERSION}/g" < st.1 > ${DESTDIR}${MANPREFIX}/man1/st.1 + @chmod 644 ${DESTDIR}${MANPREFIX}/man1/st.1 + @echo Please see the README file regarding the terminfo entry of st. +- @tic -s st.info ++ @sed 's/st\([^t].*\)/st-git\1/g' st.info > st-git.info ++ @tic -s st-git.info + + uninstall: + @echo removing executable file from ${DESTDIR}${PREFIX}/bin +diff --git a/config.def.h b/config.def.h +index 9e61010..9c33167 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -63,7 +63,7 @@ static unsigned int cursorthickness = 2; + static int bellvolume = 0; + + /* default TERM value */ +-static char termname[] = "st-256color"; ++static char termname[] = "st-git-256color"; + + static unsigned int tabspaces = 8; + diff --git a/st.suckless.org/patches/st-scrollback-git-20160425.diff b/st.suckless.org/patches/st-scrollback-git-20160425.diff @@ -1,387 +0,0 @@ -diff --git a/config.def.h b/config.def.h -index 9e61010..0bfa5aa 100644 ---- a/config.def.h -+++ b/config.def.h -@@ -7,6 +7,7 @@ - */ - static char font[] = "Liberation Mono:pixelsize=12:antialias=true:autohint=true"; - static int borderpx = 2; -+#define histsize 2000 - - /* - * What program is execed by st depends of these precedence rules: -@@ -157,6 +158,8 @@ static Shortcut shortcuts[] = { - { MODKEY|ShiftMask, XK_C, clipcopy, {.i = 0} }, - { MODKEY|ShiftMask, XK_V, clippaste, {.i = 0} }, - { MODKEY, 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 27536d2..5bfdb21 100644 ---- a/st.c -+++ b/st.c -@@ -86,6 +86,8 @@ char *argv0; - #define TRUERED(x) (((x) & 0xff0000) >> 8) - #define TRUEGREEN(x) (((x) & 0xff00)) - #define TRUEBLUE(x) (((x) & 0xff) << 8) -+#define TLINE(y) ((y) < term.scr ? term.hist[((y) + term.histi - term.scr \ -+ + histsize + 1) % histsize] : term.line[(y) - term.scr]) - - - enum glyph_attribute { -@@ -228,26 +230,6 @@ typedef struct { - int narg; /* nb of args */ - } STREscape; - --/* Internal representation of the screen */ --typedef struct { -- int row; /* nb row */ -- int col; /* nb col */ -- Line *line; /* screen */ -- Line *alt; /* alternate screen */ -- 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; -- - /* Purely graphic info */ - typedef struct { - Display *dpy; -@@ -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 *); -@@ -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; -@@ -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); -@@ -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; -@@ -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; -@@ -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))) -@@ -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; - } -@@ -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; - -@@ -1491,6 +1498,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; - } - -@@ -1500,6 +1510,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. -@@ -1691,13 +1704,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); - -@@ -1711,13 +1764,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); - -@@ -1766,7 +1826,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++; - } -@@ -1931,14 +1991,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 -@@ -2372,11 +2432,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); -@@ -2872,7 +2932,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); - } -@@ -2885,7 +2945,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); - } -@@ -3048,7 +3108,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; -@@ -3088,6 +3148,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)); -@@ -3980,11 +4048,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)) -@@ -4004,7 +4072,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/st-scrollback-git-20160616.diff b/st.suckless.org/patches/st-scrollback-git-20160616.diff @@ -0,0 +1,387 @@ +diff --git a/config.def.h b/config.def.h +index 9e61010..0bfa5aa 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -7,6 +7,7 @@ + */ + static char font[] = "Liberation Mono:pixelsize=12:antialias=true:autohint=true"; + static int borderpx = 2; ++#define histsize 2000 + + /* + * What program is execed by st depends of these precedence rules: +@@ -157,6 +158,8 @@ static Shortcut shortcuts[] = { + { MODKEY|ShiftMask, XK_C, clipcopy, {.i = 0} }, + { MODKEY|ShiftMask, XK_V, clippaste, {.i = 0} }, + { MODKEY, 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 2594c65..233d301 100644 +--- a/st.c ++++ b/st.c +@@ -86,6 +86,8 @@ char *argv0; + #define TRUERED(x) (((x) & 0xff0000) >> 8) + #define TRUEGREEN(x) (((x) & 0xff00)) + #define TRUEBLUE(x) (((x) & 0xff) << 8) ++#define TLINE(y) ((y) < term.scr ? term.hist[((y) + term.histi - term.scr \ ++ + histsize + 1) % histsize] : term.line[(y) - term.scr]) + + + enum glyph_attribute { +@@ -228,26 +230,6 @@ typedef struct { + int narg; /* nb of args */ + } STREscape; + +-/* Internal representation of the screen */ +-typedef struct { +- int row; /* nb row */ +- int col; /* nb col */ +- Line *line; /* screen */ +- Line *alt; /* alternate screen */ +- 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; +- + /* Purely graphic info */ + typedef struct { + Display *dpy; +@@ -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 *); +@@ -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; +@@ -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); +@@ -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; +@@ -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; +@@ -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))) +@@ -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; + } +@@ -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; + +@@ -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; + } + +@@ -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. +@@ -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); + +@@ -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); + +@@ -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++; + } +@@ -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 +@@ -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); +@@ -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); + } +@@ -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); + } +@@ -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; +@@ -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)); +@@ -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)) +@@ -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/st-scrollback-mouse-altscreen-git-20160203.diff b/st.suckless.org/patches/st-scrollback-mouse-altscreen-git-20160203.diff @@ -1,40 +0,0 @@ -diff --git a/config.def.h b/config.def.h -index db0bf24..1610013 100644 ---- a/config.def.h -+++ b/config.def.h -@@ -143,8 +143,8 @@ static MouseShortcut mshortcuts[] = { - - static MouseKey mkeys[] = { - /* button mask function argument */ -- { Button4, ShiftMask, kscrollup, {.i = 1} }, -- { Button5, ShiftMask, kscrolldown, {.i = 1} }, -+ { Button4, XK_NO_MOD, kscrollup, {.i = 1} }, -+ { Button5, XK_NO_MOD, kscrolldown, {.i = 1} }, - }; - - /* Internal keyboard shortcuts. */ -diff --git a/st.c b/st.c -index 1c9df8f..acb4d8a 100644 ---- a/st.c -+++ b/st.c -@@ -967,13 +967,14 @@ bpress(XEvent *e) - return; - } - -- for (ms = mshortcuts; ms < mshortcuts + LEN(mshortcuts); ms++) { -- if (e->xbutton.button == ms->b -- && match(ms->mask, e->xbutton.state)) { -- ttysend(ms->s, strlen(ms->s)); -- return; -+ if (IS_SET(MODE_ALTSCREEN)) -+ for (ms = mshortcuts; ms < mshortcuts + LEN(mshortcuts); ms++) { -+ if (e->xbutton.button == ms->b -+ && match(ms->mask, e->xbutton.state)) { -+ ttysend(ms->s, strlen(ms->s)); -+ return; -+ } - } -- } - - for (mk = mkeys; mk < mkeys + LEN(mkeys); mk++) { - if (e->xbutton.button == mk->b diff --git a/st.suckless.org/patches/st-scrollback-mouse-altscreen-git-20160616.diff b/st.suckless.org/patches/st-scrollback-mouse-altscreen-git-20160616.diff @@ -0,0 +1,25 @@ +diff --git a/st.c b/st.c +index 2594c65..bf5dc3e 100644 +--- a/st.c ++++ b/st.c +@@ -952,13 +952,14 @@ bpress(XEvent *e) + return; + } + +- for (ms = mshortcuts; ms < mshortcuts + LEN(mshortcuts); ms++) { +- if (e->xbutton.button == ms->b +- && match(ms->mask, e->xbutton.state)) { +- ttysend(ms->s, strlen(ms->s)); +- return; ++ if (IS_SET(MODE_ALTSCREEN)) ++ for (ms = mshortcuts; ms < mshortcuts + LEN(mshortcuts); ms++) { ++ if (e->xbutton.button == ms->b ++ && match(ms->mask, e->xbutton.state)) { ++ ttysend(ms->s, strlen(ms->s)); ++ return; ++ } + } +- } + + if (e->xbutton.button == Button1) { + clock_gettime(CLOCK_MONOTONIC, &now); diff --git a/st.suckless.org/patches/st-scrollback-mouse-git-20151106.diff b/st.suckless.org/patches/st-scrollback-mouse-git-20151106.diff @@ -1,62 +0,0 @@ -diff --git a/config.def.h b/config.def.h -index 35060d7..30fa7a6 100644 ---- a/config.def.h -+++ b/config.def.h -@@ -137,8 +137,14 @@ static unsigned int defaultunderline = 7; - */ - static MouseShortcut mshortcuts[] = { - /* button mask string */ -- { Button4, XK_ANY_MOD, "\031" }, -- { Button5, XK_ANY_MOD, "\005" }, -+ { Button4, XK_NO_MOD, "\031" }, -+ { Button5, XK_NO_MOD, "\005" }, -+}; -+ -+static MouseKey mkeys[] = { -+ /* button mask function argument */ -+ { Button4, ShiftMask, kscrollup, {.i = 1} }, -+ { Button5, ShiftMask, kscrolldown, {.i = 1} }, - }; - - /* Internal keyboard shortcuts. */ -diff --git a/st.c b/st.c -index 03b9473..91d4230 100644 ---- a/st.c -+++ b/st.c -@@ -322,6 +322,13 @@ typedef union { - } Arg; - - typedef struct { -+ uint b; -+ uint mask; -+ void (*func)(const Arg *); -+ const Arg arg; -+} MouseKey; -+ -+typedef struct { - uint mod; - KeySym keysym; - void (*func)(const Arg *); -@@ -952,6 +959,7 @@ bpress(XEvent *e) - { - struct timespec now; - MouseShortcut *ms; -+ MouseKey *mk; - - if (IS_SET(MODE_MOUSE) && !(e->xbutton.state & forceselmod)) { - mousereport(e); -@@ -966,6 +974,14 @@ bpress(XEvent *e) - } - } - -+ for (mk = mkeys; mk < mkeys + LEN(mkeys); mk++) { -+ if (e->xbutton.button == mk->b -+ && match(mk->mask, e->xbutton.state)) { -+ mk->func(&mk->arg); -+ return; -+ } -+ } -+ - if (e->xbutton.button == Button1) { - clock_gettime(CLOCK_MONOTONIC, &now); - diff --git a/st.suckless.org/patches/st-scrollback-mouse-git-20160616.diff b/st.suckless.org/patches/st-scrollback-mouse-git-20160616.diff @@ -0,0 +1,62 @@ +diff --git a/config.def.h b/config.def.h +index 9e61010..f69b7d1 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -136,8 +136,14 @@ static unsigned int defaultunderline = 7; + */ + static MouseShortcut mshortcuts[] = { + /* button mask string */ +- { Button4, XK_ANY_MOD, "\031" }, +- { Button5, XK_ANY_MOD, "\005" }, ++ { Button4, XK_NO_MOD, "\031" }, ++ { Button5, XK_NO_MOD, "\005" }, ++}; ++ ++static MouseKey mkeys[] = { ++ /* button mask function argument */ ++ { Button4, ShiftMask, kscrollup, {.i = 1} }, ++ { Button5, ShiftMask, kscrolldown, {.i = 1} }, + }; + + /* Internal keyboard shortcuts. */ +diff --git a/st.c b/st.c +index 2594c65..9744bcf 100644 +--- a/st.c ++++ b/st.c +@@ -318,6 +318,13 @@ typedef union { + } Arg; + + typedef struct { ++ uint b; ++ uint mask; ++ void (*func)(const Arg *); ++ const Arg arg; ++} MouseKey; ++ ++typedef struct { + uint mod; + KeySym keysym; + void (*func)(const Arg *); +@@ -946,6 +953,7 @@ bpress(XEvent *e) + { + struct timespec now; + MouseShortcut *ms; ++ MouseKey *mk; + + if (IS_SET(MODE_MOUSE) && !(e->xbutton.state & forceselmod)) { + mousereport(e); +@@ -960,6 +968,14 @@ bpress(XEvent *e) + } + } + ++ for (mk = mkeys; mk < mkeys + LEN(mkeys); mk++) { ++ if (e->xbutton.button == mk->b ++ && match(mk->mask, e->xbutton.state)) { ++ mk->func(&mk->arg); ++ return; ++ } ++ } ++ + if (e->xbutton.button == Button1) { + clock_gettime(CLOCK_MONOTONIC, &now); + diff --git a/st.suckless.org/patches/st-solarized-dark-git-20151119.diff b/st.suckless.org/patches/st-solarized-dark-git-20151119.diff @@ -1,68 +0,0 @@ -diff --git a/config.def.h b/config.def.h -index fd09d72..1c0c1f9 100644 ---- a/config.def.h -+++ b/config.def.h -@@ -69,31 +69,23 @@ static unsigned int tabspaces = 8; - - /* Terminal colors (16 first used in escape sequence) */ - static const char *colorname[] = { -- /* 8 normal colors */ -- "black", -- "red3", -- "green3", -- "yellow3", -- "blue2", -- "magenta3", -- "cyan3", -- "gray90", -- -- /* 8 bright colors */ -- "gray50", -- "red", -- "green", -- "yellow", -- "#5c5cff", -- "magenta", -- "cyan", -- "white", -- -- [255] = 0, -- -- /* more colors can be added after 255 to use with DefaultXX */ -- "#cccccc", -- "#555555", -+ /* solarized dark */ -+ "#073642", /* 0: black */ -+ "#dc322f", /* 1: red */ -+ "#859900", /* 2: green */ -+ "#b58900", /* 3: yellow */ -+ "#268bd2", /* 4: blue */ -+ "#d33682", /* 5: magenta */ -+ "#2aa198", /* 6: cyan */ -+ "#eee8d5", /* 7: white */ -+ "#002b36", /* 8: brblack */ -+ "#cb4b16", /* 9: brred */ -+ "#586e75", /* 10: brgreen */ -+ "#657b83", /* 11: bryellow */ -+ "#839496", /* 12: brblue */ -+ "#6c71c4", /* 13: brmagenta*/ -+ "#93a1a1", /* 14: brcyan */ -+ "#fdf6e3", /* 15: brwhite */ - }; - - -@@ -101,10 +93,10 @@ static const char *colorname[] = { - * Default colors (colorname index) - * foreground, background, cursor, reverse cursor - */ --static unsigned int defaultfg = 7; --static unsigned int defaultbg = 0; --static unsigned int defaultcs = 256; --static unsigned int defaultrcs = 257; -+static unsigned int defaultfg = 12; -+static unsigned int defaultbg = 8; -+static unsigned int defaultcs = 14; -+static unsigned int defaultrcs = 15; - - /* - * Default shape of cursor diff --git a/st.suckless.org/patches/st-solarized-dark-git-20160616.diff b/st.suckless.org/patches/st-solarized-dark-git-20160616.diff @@ -0,0 +1,68 @@ +diff --git a/config.def.h b/config.def.h +index 9e61010..df5beb8 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -69,31 +69,23 @@ static unsigned int tabspaces = 8; + + /* Terminal colors (16 first used in escape sequence) */ + static const char *colorname[] = { +- /* 8 normal colors */ +- "black", +- "red3", +- "green3", +- "yellow3", +- "blue2", +- "magenta3", +- "cyan3", +- "gray90", +- +- /* 8 bright colors */ +- "gray50", +- "red", +- "green", +- "yellow", +- "#5c5cff", +- "magenta", +- "cyan", +- "white", +- +- [255] = 0, +- +- /* more colors can be added after 255 to use with DefaultXX */ +- "#cccccc", +- "#555555", ++ /* solarized dark */ ++ "#073642", /* 0: black */ ++ "#dc322f", /* 1: red */ ++ "#859900", /* 2: green */ ++ "#b58900", /* 3: yellow */ ++ "#268bd2", /* 4: blue */ ++ "#d33682", /* 5: magenta */ ++ "#2aa198", /* 6: cyan */ ++ "#eee8d5", /* 7: white */ ++ "#002b36", /* 8: brblack */ ++ "#cb4b16", /* 9: brred */ ++ "#586e75", /* 10: brgreen */ ++ "#657b83", /* 11: bryellow */ ++ "#839496", /* 12: brblue */ ++ "#6c71c4", /* 13: brmagenta*/ ++ "#93a1a1", /* 14: brcyan */ ++ "#fdf6e3", /* 15: brwhite */ + }; + + +@@ -101,10 +93,10 @@ static const char *colorname[] = { + * Default colors (colorname index) + * foreground, background, cursor, reverse cursor + */ +-static unsigned int defaultfg = 7; +-static unsigned int defaultbg = 0; +-static unsigned int defaultcs = 256; +-static unsigned int defaultrcs = 257; ++static unsigned int defaultfg = 12; ++static unsigned int defaultbg = 8; ++static unsigned int defaultcs = 14; ++static unsigned int defaultrcs = 15; + + /* + * Default shape of cursor diff --git a/st.suckless.org/patches/st-solarized-light-git-20151119.diff b/st.suckless.org/patches/st-solarized-light-git-20151119.diff @@ -1,68 +0,0 @@ -diff --git a/config.def.h b/config.def.h -index fd09d72..2d3c9d0 100644 ---- a/config.def.h -+++ b/config.def.h -@@ -69,31 +69,23 @@ static unsigned int tabspaces = 8; - - /* Terminal colors (16 first used in escape sequence) */ - static const char *colorname[] = { -- /* 8 normal colors */ -- "black", -- "red3", -- "green3", -- "yellow3", -- "blue2", -- "magenta3", -- "cyan3", -- "gray90", -- -- /* 8 bright colors */ -- "gray50", -- "red", -- "green", -- "yellow", -- "#5c5cff", -- "magenta", -- "cyan", -- "white", -- -- [255] = 0, -- -- /* more colors can be added after 255 to use with DefaultXX */ -- "#cccccc", -- "#555555", -+ /* solarized light */ -+ "#eee8d5", /* 0: black */ -+ "#dc322f", /* 1: red */ -+ "#859900", /* 2: green */ -+ "#b58900", /* 3: yellow */ -+ "#268bd2", /* 4: blue */ -+ "#d33682", /* 5: magenta */ -+ "#2aa198", /* 6: cyan */ -+ "#073642", /* 7: white */ -+ "#fdf6e3", /* 8: brblack */ -+ "#cb4b16", /* 9: brred */ -+ "#93a1a1", /* 10: brgreen */ -+ "#839496", /* 11: bryellow */ -+ "#657b83", /* 12: brblue */ -+ "#6c71c4", /* 13: brmagenta*/ -+ "#586e75", /* 14: brcyan */ -+ "#002b36", /* 15: brwhite */ - }; - - -@@ -101,10 +93,10 @@ static const char *colorname[] = { - * Default colors (colorname index) - * foreground, background, cursor, reverse cursor - */ --static unsigned int defaultfg = 7; --static unsigned int defaultbg = 0; --static unsigned int defaultcs = 256; --static unsigned int defaultrcs = 257; -+static unsigned int defaultfg = 12; -+static unsigned int defaultbg = 8; -+static unsigned int defaultcs = 14; -+static unsigned int defaultrcs = 15; - - /* - * Default shape of cursor diff --git a/st.suckless.org/patches/st-solarized-light-git-20160616.diff b/st.suckless.org/patches/st-solarized-light-git-20160616.diff @@ -0,0 +1,68 @@ +diff --git a/config.def.h b/config.def.h +index 9e61010..a389c04 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -69,31 +69,23 @@ static unsigned int tabspaces = 8; + + /* Terminal colors (16 first used in escape sequence) */ + static const char *colorname[] = { +- /* 8 normal colors */ +- "black", +- "red3", +- "green3", +- "yellow3", +- "blue2", +- "magenta3", +- "cyan3", +- "gray90", +- +- /* 8 bright colors */ +- "gray50", +- "red", +- "green", +- "yellow", +- "#5c5cff", +- "magenta", +- "cyan", +- "white", +- +- [255] = 0, +- +- /* more colors can be added after 255 to use with DefaultXX */ +- "#cccccc", +- "#555555", ++ /* solarized light */ ++ "#eee8d5", /* 0: black */ ++ "#dc322f", /* 1: red */ ++ "#859900", /* 2: green */ ++ "#b58900", /* 3: yellow */ ++ "#268bd2", /* 4: blue */ ++ "#d33682", /* 5: magenta */ ++ "#2aa198", /* 6: cyan */ ++ "#073642", /* 7: white */ ++ "#fdf6e3", /* 8: brblack */ ++ "#cb4b16", /* 9: brred */ ++ "#93a1a1", /* 10: brgreen */ ++ "#839496", /* 11: bryellow */ ++ "#657b83", /* 12: brblue */ ++ "#6c71c4", /* 13: brmagenta*/ ++ "#586e75", /* 14: brcyan */ ++ "#002b36", /* 15: brwhite */ + }; + + +@@ -101,10 +93,10 @@ static const char *colorname[] = { + * Default colors (colorname index) + * foreground, background, cursor, reverse cursor + */ +-static unsigned int defaultfg = 7; +-static unsigned int defaultbg = 0; +-static unsigned int defaultcs = 256; +-static unsigned int defaultrcs = 257; ++static unsigned int defaultfg = 12; ++static unsigned int defaultbg = 8; ++static unsigned int defaultcs = 14; ++static unsigned int defaultrcs = 15; + + /* + * Default shape of cursor diff --git a/st.suckless.org/patches/st-spoiler-git-20150922.diff b/st.suckless.org/patches/st-spoiler-git-20150922.diff @@ -1,22 +0,0 @@ -diff --git a/st.c b/st.c -index bcf74b3..0763f9f 100644 ---- a/st.c -+++ b/st.c -@@ -3752,9 +3752,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_BOLD_FAINT) == ATTR_FAINT) { diff --git a/st.suckless.org/patches/st-spoiler-git-20160616.diff b/st.suckless.org/patches/st-spoiler-git-20160616.diff @@ -0,0 +1,22 @@ +diff --git a/st.c b/st.c +index 2594c65..742bc5c 100644 +--- a/st.c ++++ b/st.c +@@ -3748,9 +3748,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_BOLD_FAINT) == ATTR_FAINT) { diff --git a/st.suckless.org/patches/st-visualbell-git-20160209.diff b/st.suckless.org/patches/st-visualbell-git-20160209.diff @@ -1,42 +0,0 @@ -diff --git a/st.c b/st.c -index 0536b6f..948de40 100644 ---- a/st.c -+++ b/st.c -@@ -532,6 +532,7 @@ static char *opt_line = NULL; - static char *opt_name = NULL; - static char *opt_title = NULL; - static int oldbutton = 3; /* button event on startup: 3 = release */ -+static int bellon = 0; /* visual bell status */ - - static char *usedfont = NULL; - static double usedfontsize = 0; -@@ -2767,6 +2768,15 @@ tcontrolcode(uchar ascii) - xseturgency(1); - if (bellvolume) - XkbBell(xw.dpy, xw.win, bellvolume, (Atom)NULL); -+ -+ /* visual bell*/ -+ if (!bellon) { -+ bellon = 1; -+ MODBIT(term.mode, !IS_SET(MODE_REVERSE), MODE_REVERSE); -+ redraw(); -+ XFlush(xw.dpy); -+ MODBIT(term.mode, !IS_SET(MODE_REVERSE), MODE_REVERSE); -+ } - } - break; - case '\033': /* ESC */ -@@ -4303,7 +4313,12 @@ run(void) - (handler[ev.type])(&ev); - } - -- draw(); -+ if (bellon) { -+ bellon = 0; -+ redraw(); -+ } -+ else draw(); -+ - XFlush(xw.dpy); - - if (xev && !FD_ISSET(xfd, &rfd)) diff --git a/st.suckless.org/patches/st-visualbell-git-20160616.diff b/st.suckless.org/patches/st-visualbell-git-20160616.diff @@ -0,0 +1,42 @@ +diff --git a/st.c b/st.c +index 2594c65..89bffdd 100644 +--- a/st.c ++++ b/st.c +@@ -532,6 +532,7 @@ static char *opt_line = NULL; + static char *opt_name = NULL; + static char *opt_title = NULL; + static int oldbutton = 3; /* button event on startup: 3 = release */ ++static int bellon = 0; /* visual bell status */ + + static char *usedfont = NULL; + static double usedfontsize = 0; +@@ -2766,6 +2767,15 @@ tcontrolcode(uchar ascii) + xseturgency(1); + if (bellvolume) + XkbBell(xw.dpy, xw.win, bellvolume, (Atom)NULL); ++ ++ /* visual bell*/ ++ if (!bellon) { ++ bellon = 1; ++ MODBIT(term.mode, !IS_SET(MODE_REVERSE), MODE_REVERSE); ++ redraw(); ++ XFlush(xw.dpy); ++ MODBIT(term.mode, !IS_SET(MODE_REVERSE), MODE_REVERSE); ++ } + } + break; + case '\033': /* ESC */ +@@ -4292,7 +4302,12 @@ run(void) + (handler[ev.type])(&ev); + } + +- draw(); ++ if (bellon) { ++ bellon = 0; ++ redraw(); ++ } ++ else draw(); ++ + XFlush(xw.dpy); + + if (xev && !FD_ISSET(xfd, &rfd)) diff --git a/st.suckless.org/patches/visualbell.md b/st.suckless.org/patches/visualbell.md @@ -16,9 +16,10 @@ monitor. Download -------- - * [st-visualbell-git-20160209.diff](st-visualbell-git-20160209.diff) + * [st-visualbell-git-20160616.diff](st-visualbell-git-20160616.diff) Authors ------- * Matthias Schoth - mschoth@gmail.com + * Laslo Hunhold - dev@frign.de (git port)