sites

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

commit 9ef8a780169a0c09b72799da4f2714615c91f14f
parent 4a242c59d447a6744b4efbff5689d7fc457a416e
Author: Ivan Tham <pickfire@riseup.net>
Date:   Thu,  4 Feb 2016 18:39:50 +0800

[st] Improve scrollback patch wording

    - externalpipe play nice with scrollback patch

Diffstat:
Mst.suckless.org/patches/externalpipe.md | 2+-
Mst.suckless.org/patches/scrollback.md | 11++++++-----
Dst.suckless.org/patches/st-git-20150917-externalpipe.diff | 75---------------------------------------------------------------------------
Ast.suckless.org/patches/st-git-20160204-externalpipe.diff | 75+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 82 insertions(+), 81 deletions(-)

diff --git a/st.suckless.org/patches/externalpipe.md b/st.suckless.org/patches/externalpipe.md @@ -27,7 +27,7 @@ Download * [st-0.4.1-externalpipe.diff](st-0.4.1-externalpipe.diff) * [st-0.5-externalpipe.diff](st-0.5-externalpipe.diff) * [st-0.6-externalpipe.diff](st-0.6-externalpipe.diff) -* [st-git-20150917-externalpipe.diff](st-git-20150917-externalpipe.diff) +* [st-git-20160204-externalpipe.diff](st-git-20160204-externalpipe.diff) Authors ------- diff --git a/st.suckless.org/patches/scrollback.md b/st.suckless.org/patches/scrollback.md @@ -12,14 +12,15 @@ Download * [st-git-20151217-scrollback.diff](st-git-20151217-scrollback.diff) Apply the following patch on top of the previous to allow scrolling -using Shift+MouseWheel. +using `Shift+MouseWheel`. * [st-git-20151106-scrollback-mouse.diff](st-git-20151106-scrollback-mouse.diff) -Apply the following patch on top of the previous two to allow scrolling -the backbuffer using MouseWheel only when not in MODE_ALTSCREEN. -This way when e.g. viweing files in less the content is being scrolled instead of the -scrollback buffer. Consequently the Shift modifier for scrolling is not needed anymore. +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 +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-git-20160203-scrollback-mouse-altscreen.diff](st-git-20160203-scrollback-mouse-altscreen.diff) diff --git a/st.suckless.org/patches/st-git-20150917-externalpipe.diff b/st.suckless.org/patches/st-git-20150917-externalpipe.diff @@ -1,75 +0,0 @@ -diff --git a/st.c b/st.c -index bd8b815..a43e615 100644 ---- a/st.c -+++ b/st.c -@@ -328,6 +328,7 @@ static void clipcopy(const Arg *); - static void clippaste(const Arg *); - static void numlock(const Arg *); - static void selpaste(const Arg *); -+static void externalpipe(const Arg *); - static void xzoom(const Arg *); - static void xzoomabs(const Arg *); - static void xzoomreset(const Arg *); -@@ -2920,6 +2921,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-git-20160204-externalpipe.diff b/st.suckless.org/patches/st-git-20160204-externalpipe.diff @@ -0,0 +1,75 @@ +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];