[wiki] [sites] [st][patch][csi 22 23] update to 0.8.5 || wael
commit f0f2f3d4e8a5b8549aaf4f8e29784c6b619d87e0
Author: wael <40663_AT_protonmail.com>
Date: Mon Apr 11 21:33:53 2022 +0300
[st][patch][csi 22 23] update to 0.8.5
diff --git a/st.suckless.org/patches/csi_22_23/index.md b/st.suckless.org/patches/csi_22_23/index.md
index 7bb6bb09..53c9331e 100644
--- a/st.suckless.org/patches/csi_22_23/index.md
+++ b/st.suckless.org/patches/csi_22_23/index.md
_AT_@ -9,7 +9,9 @@ restore window title (for instance nvim does this when opening and closing).
Download
--------
* [st-csi\_22\_23-0.8.4.diff](st-csi_22_23-0.8.4.diff)
+* [st-csi\_22\_23-0.8.5.diff](st-csi_22_23-0.8.5.diff)
Authors
-------
* Ashish Kumar Yadav - <ashishkumar.yadav_AT_students.iiserpune.ac.in>
+* wael - 40663_AT_protonmail.com (0.8.5 fix)
diff --git a/st.suckless.org/patches/csi_22_23/st-csi_22_23-0.8.5.diff b/st.suckless.org/patches/csi_22_23/st-csi_22_23-0.8.5.diff
new file mode 100644
index 00000000..c49aa30f
--- /dev/null
+++ b/st.suckless.org/patches/csi_22_23/st-csi_22_23-0.8.5.diff
_AT_@ -0,0 +1,208 @@
+From c90af45228c1100377d64ad021fa3f0cff9a1df4 Mon Sep 17 00:00:00 2001
+From: wael <40663_AT_protonmail.com>
+Date: Mon, 11 Apr 2022 21:28:43 +0300
+Subject: [PATCH] [st][patch][csi 22 23] update to 0.8.5
+
+---
+ st.c | 36 ++++++++++++++++++++++++++++++++----
+ st.info | 4 ++--
+ win.h | 4 +++-
+ x.c | 41 ++++++++++++++++++++++++++++++++++++++---
+ 4 files changed, 75 insertions(+), 10 deletions(-)
+
+diff --git a/st.c b/st.c
+index f43cfd3..2802381 100644
+--- a/st.c
++++ b/st.c
+_AT_@ -1801,6 +1801,33 @@ csihandle(void)
+ goto unknown;
+ }
+ break;
++ case 't': /* title stack operations */
++ switch (csiescseq.arg[0]) {
++ case 22: /* pust current title on stack */
++ switch (csiescseq.arg[1]) {
++ case 0:
++ case 1:
++ case 2:
++ xpushtitle();
++ break;
++ default:
++ goto unknown;
++ }
++ break;
++ case 23: /* pop last title from stack */
++ switch (csiescseq.arg[1]) {
++ case 0:
++ case 1:
++ case 2:
++ xsettitle(NULL, 1);
++ break;
++ default:
++ goto unknown;
++ }
++ break;
++ default:
++ goto unknown;
++ }
+ }
+ }
+
+_AT_@ -1885,7 +1912,7 @@ strhandle(void)
+ switch (par) {
+ case 0:
+ if (narg > 1) {
+- xsettitle(strescseq.args[1]);
++ xsettitle(strescseq.args[1], 0);
+ xseticontitle(strescseq.args[1]);
+ }
+ return;
+_AT_@ -1895,7 +1922,7 @@ strhandle(void)
+ return;
+ case 2:
+ if (narg > 1)
+- xsettitle(strescseq.args[1]);
++ xsettitle(strescseq.args[1], 0);
+ return;
+ case 52:
+ if (narg > 2 && allowwindowops) {
+_AT_@ -1973,7 +2000,7 @@ strhandle(void)
+ }
+ break;
+ case 'k': /* old title set compatibility */
+- xsettitle(strescseq.args[0]);
++ xsettitle(strescseq.args[0], 0);
+ return;
+ case 'P': /* DCS -- Device Control String */
+ case '_': /* APC -- Application Program Command */
+_AT_@ -2345,6 +2372,7 @@ eschandle(uchar ascii)
+ break;
+ case 'c': /* RIS -- Reset to initial state */
+ treset();
++ xfreetitlestack();
+ resettitle();
+ xloadcols();
+ break;
+_AT_@ -2631,7 +2659,7 @@ tresize(int col, int row)
+ void
+ resettitle(void)
+ {
+- xsettitle(NULL);
++ xsettitle(NULL, 0);
+ }
+
+ void
+diff --git a/st.info b/st.info
+index 8201ad6..aeef606 100644
+--- a/st.info
++++ b/st.info
+_AT_@ -161,7 +161,7 @@ st-mono| simpleterm monocolor,
+ rin=\E[%p1%dT,
+ ritm=\E[23m,
+ rmacs=\E(B,
+- rmcup=\E[?1049l,
++ rmcup=\E[?1049l\E[23;0;0t,
+ rmir=\E[4l,
+ rmkx=\E[?1l\E>,
+ rmso=\E[27m,
+_AT_@ -172,7 +172,7 @@ st-mono| simpleterm monocolor,
+ sitm=\E[3m,
+ sgr0=\E[0m,
+ smacs=\E(0,
+- smcup=\E[?1049h,
++ smcup=\E[?1049h\E[22;0;0t,
+ smir=\E[4h,
+ smkx=\E[?1h\E=,
+ smso=\E[7m,
+diff --git a/win.h b/win.h
+index e6e4369..ef67fd6 100644
+--- a/win.h
++++ b/win.h
+_AT_@ -31,7 +31,9 @@ void xfinishdraw(void);
+ void xloadcols(void);
+ int xsetcolorname(int, const char *);
+ void xseticontitle(char *);
+-void xsettitle(char *);
++void xfreetitlestack(void);
++void xsettitle(char *, int);
++void xpushtitle(void);
+ int xsetcursor(int);
+ void xsetmode(int, unsigned int);
+ void xsetpointermotion(int);
+diff --git a/x.c b/x.c
+index 2a3bd38..babb04c 100644
+--- a/x.c
++++ b/x.c
+_AT_@ -63,6 +63,9 @@ static void ttysend(const Arg *);
+ /* config.h for applying patches and the configuration. */
+ #include "config.h"
+
++/* size of title stack */
++#define TITLESTACKSIZE 8
++
+ /* XEMBED messages */
+ #define XEMBED_FOCUS_IN 4
+ #define XEMBED_FOCUS_OUT 5
+_AT_@ -220,6 +223,8 @@ static DC dc;
+ static XWindow xw;
+ static XSelection xsel;
+ static TermWindow win;
++static int tstki; /* title stack index */
++static char *titlestack[TITLESTACKSIZE]; /* title stack */
+
+ /* Font Ring Cache */
+ enum {
+_AT_@ -1626,10 +1631,30 @@ xseticontitle(char *p)
+ }
+
+ void
+-xsettitle(char *p)
++xfreetitlestack(void)
+ {
+- XTextProperty prop;
+- DEFAULT(p, opt_title);
++ for (int i = 0; i < LEN(titlestack); i++) {
++ free(titlestack[i]);
++ titlestack[i] = NULL;
++ }
++}
++
++void
++xsettitle(char *p, int pop)
++{
++ XTextProperty prop;
++
++ free(titlestack[tstki]);
++ if (pop) {
++ titlestack[tstki] = NULL;
++ tstki = (tstki - 1 + TITLESTACKSIZE) % TITLESTACKSIZE;
++ p = titlestack[tstki] ? titlestack[tstki] : opt_title;
++ } else if (p) {
++ titlestack[tstki] = xstrdup(p);
++ } else {
++ titlestack[tstki] = NULL;
++ p = opt_title;
++ }
+
+ if (Xutf8TextListToTextProperty(xw.dpy, &p, 1, XUTF8StringStyle,
+ &prop) != Success)
+_AT_@ -1639,6 +1664,16 @@ xsettitle(char *p)
+ XFree(prop.value);
+ }
+
++void
++xpushtitle(void)
++{
++ int tstkin = (tstki + 1) % TITLESTACKSIZE;
++
++ free(titlestack[tstkin]);
++ titlestack[tstkin] = titlestack[tstki] ? xstrdup(titlestack[tstki]) : NULL;
++ tstki = tstkin;
++}
++
+ int
+ xstartdraw(void)
+ {
+--
+2.35.1
+
Received on Mon Apr 11 2022 - 20:34:53 CEST
This archive was generated by hypermail 2.3.0
: Mon Apr 11 2022 - 20:36:49 CEST