commit 682c36baeeebdb4888a6170b202bd68a1a967d76
parent f6eca21e35a8128be173496553bea71323f8b916
Author: . <chyleson165@disroot.org>
Date: Sun, 15 Feb 2026 17:45:05 -0300
[st][PATCH] Add st-externalpipe-eternal-ringbuffer patch
Diffstat:
2 files changed, 45 insertions(+), 1 deletion(-)
diff --git a/st.suckless.org/patches/externalpipe/index.md b/st.suckless.org/patches/externalpipe/index.md
@@ -41,11 +41,15 @@ Download
* [st-externalpipe-0.8.4.diff](st-externalpipe-0.8.4.diff)
* [st-externalpipe-0.8.5.diff](st-externalpipe-0.8.5.diff)
-When using the scrollback patch, you can apply this patch ontop in order to use
+When using the scrollback patch, you can apply this patch on top in order to use
externalpipe onto the entire terminal history:
* [st-externalpipe-eternal-0.8.3.diff](st-externalpipe-eternal-0.8.3.diff)
+Apply this version of externalpipe-eternal if you're using scrollback-ringbuffer:
+
+* [st-externalpipe-eternal-ringbuffer-0.9.3.diff](st-externalpipe-eternal-ringbuffer-0.9.3.diff)
+
Authors
-------
* Rob Pilling - <robpilling@gmail.com> (original, 0.8, git ports)
diff --git a/st.suckless.org/patches/externalpipe/st-externalpipe-eternal-ringbuffer-0.9.3.diff b/st.suckless.org/patches/externalpipe/st-externalpipe-eternal-ringbuffer-0.9.3.diff
@@ -0,0 +1,40 @@
+diff -up a/st.c b/st.c
+--- a/st.c 2026-02-12 14:56:55.248311919 -0300
++++ b/st.c 2026-02-12 14:36:36.827197795 -0300
+@@ -2513,21 +2513,21 @@ externalpipe(const Arg *arg)
+ /* ignore sigpipe for now, in case child exists early */
+ oldsigpipe = signal(SIGPIPE, SIG_IGN);
+ newline = 0;
+- for (n = 0; n < term.row; n++) {
+- bp = term.line[n];
+- lastpos = MIN(tlinelen(n) + 1, term.col) - 1;
+- if (lastpos < 0)
+- break;
+- end = &bp[lastpos + 1];
+- for (; bp < end; ++bp)
+- if (xwrite(to[1], buf, utf8encode(bp->u, buf)) < 0)
+- break;
+- if ((newline = term.line[n][lastpos].mode & ATTR_WRAP))
+- continue;
+- if (xwrite(to[1], "\n", 1) < 0)
+- break;
+- newline = 0;
+- }
++ int histlen = term.screen[0].cur < term.screen[0].size
++ ? term.screen[0].cur
++ : term.screen[0].size;
++ int total = histlen + term.row;
++ for (int n = -histlen; n < term.row; n++) {
++ Line line = TLINE(n);
++ int len = tlinelen(n);
++ for (int i = 0; i < len; i++) {
++ char buf[UTF_SIZ];
++ if (xwrite(to[1], buf, utf8encode(line[i].u, buf)) < 0)
++ break;
++ }
++ if (len > 0 && !(line[len - 1].mode & ATTR_WRAP))
++ xwrite(to[1], "\n", 1);
++ }
+ if (newline)
+ (void)xwrite(to[1], "\n", 1);
+ close(to[1]);