[wiki] [sites] [st] Improve scrollback patch wording || Ivan Tham

From: <git_AT_suckless.org>
Date: Thu, 04 Feb 2016 11:44:01 +0100

commit 9ef8a780169a0c09b72799da4f2714615c91f14f
Author: Ivan Tham <pickfire_AT_riseup.net>
Date: Thu Feb 4 18:39:50 2016 +0800

    [st] Improve scrollback patch wording
    
        - externalpipe play nice with scrollback patch

diff --git a/st.suckless.org/patches/externalpipe.md b/st.suckless.org/patches/externalpipe.md
index 9536c61..51abe28 100644
--- a/st.suckless.org/patches/externalpipe.md
+++ b/st.suckless.org/patches/externalpipe.md
_AT_@ -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
index 1d0b4cc..8cc26e9 100644
--- a/st.suckless.org/patches/scrollback.md
+++ b/st.suckless.org/patches/scrollback.md
_AT_@ -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
deleted file mode 100644
index c6744bc..0000000
--- a/st.suckless.org/patches/st-git-20150917-externalpipe.diff
+++ /dev/null
_AT_@ -1,75 +0,0 @@
-diff --git a/st.c b/st.c
-index bd8b815..a43e615 100644
---- a/st.c
-+++ b/st.c
-_AT_@ -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 *);
-_AT_@ -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], "
", 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
new file mode 100644
index 0000000..3e974b3
--- /dev/null
+++ b/st.suckless.org/patches/st-git-20160204-externalpipe.diff
_AT_@ -0,0 +1,75 @@
+diff --git a/st.c b/st.c
+index 0536b6f..59f982c 100644
+--- a/st.c
++++ b/st.c
+_AT_@ -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"
+_AT_@ -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], "
", 1) < 0)
++ break;
++ }
++
++ close(to[1]);
++
++ /* restore */
++ signal(SIGPIPE, oldsigpipe);
++}
++
++void
+ tputc(Rune u)
+ {
+ char c[UTF_SIZ];
Received on Thu Feb 04 2016 - 11:44:01 CET

This archive was generated by hypermail 2.3.0 : Thu Feb 04 2016 - 11:48:12 CET