[wiki] [sites] [st][patch][title_parsing_fix] Add patch for st-0.8.5 || Rizqi Nur Assyaufi
commit 9a7e0cdf7d6480764940c26667dc715f868f7c52
Author: Rizqi Nur Assyaufi <bandithijo_AT_gmail.com>
Date: Mon Jul 18 00:45:58 2022 +0800
[st][patch][title_parsing_fix] Add patch for st-0.8.5
diff --git a/st.suckless.org/patches/title_parsing_fix/index.md b/st.suckless.org/patches/title_parsing_fix/index.md
index b86aaf7a..45d9a1a2 100644
--- a/st.suckless.org/patches/title_parsing_fix/index.md
+++ b/st.suckless.org/patches/title_parsing_fix/index.md
_AT_@ -12,7 +12,9 @@ that behaviour.
Download
--------
* [st-title\_parsing\_fix-0.8.4.diff](st-title_parsing_fix-0.8.4.diff)
+* [st-title\_parsing\_fix-0.8.5.diff](st-title_parsing_fix-0.8.5.diff)
Authors
-------
* Ashish Kumar Yadav - <ashishkumar.yadav_AT_students.iiserpune.ac.in>
+* Rizqi Nur Assyaufi - <bandithijo_AT_gmail.com>
diff --git a/st.suckless.org/patches/title_parsing_fix/st-title_parsing_fix-0.8.5.diff b/st.suckless.org/patches/title_parsing_fix/st-title_parsing_fix-0.8.5.diff
new file mode 100644
index 00000000..a5cee408
--- /dev/null
+++ b/st.suckless.org/patches/title_parsing_fix/st-title_parsing_fix-0.8.5.diff
_AT_@ -0,0 +1,145 @@
+From 8446609384429bfc4342ede4b52ff42214ad2b77 Mon Sep 17 00:00:00 2001
+From: Rizqi Nur Assyaufi <bandithijo_AT_gmail.com>
+Date: Mon, 18 Jul 2022 00:35:26 +0800
+Subject: [PATCH] Fixes title parsing for st-0.8.5
+
+In st, titles get truncated after the first ';' character, this patch
+fixes that.
+---
+ st.c | 38 ++++++++++++++++++++------------------
+ 1 file changed, 20 insertions(+), 18 deletions(-)
+
+diff --git a/st.c b/st.c
+index 51049ba..a2e595c 100644
+--- a/st.c
++++ b/st.c
+_AT_@ -42,6 +42,8 @@
+ #define ISCONTROLC1(c) (BETWEEN(c, 0x80, 0x9f))
+ #define ISCONTROL(c) (ISCONTROLC0(c) || ISCONTROLC1(c))
+ #define ISDELIM(u) (u && wcschr(worddelimiters, u))
++#define STRESCARGREST(n) ((n) == 0 ? strescseq.buf : strescseq.argp[(n)-1] + 1)
++#define STRESCARGJUST(n) (*(strescseq.argp[n]) = '+
+ enum term_mode {
+ MODE_WRAP = 1 << 0,
+_AT_@ -148,7 +150,7 @@ typedef struct {
+ char *buf; /* allocated raw string */
+ size_t siz; /* allocation size */
+ size_t len; /* raw string length */
+- char *args[STR_ARG_SIZ];
++ char *argp[STR_ARG_SIZ]; /* pointers to the end of nth argument */
+ int narg; /* nb of args */
+ } STREscape;
+
+_AT_@ -1885,29 +1887,30 @@ strhandle(void)
+ int j, narg, par;
+
+ term.esc &= ~(ESC_STR_END|ESC_STR);
+- strparse();
+- par = (narg = strescseq.narg) ? atoi(strescseq.args[0]) : 0;
++ strescseq.buf[strescseq.len] = '+
+ switch (strescseq.type) {
+ case ']': /* OSC -- Operating System Command */
++ strparse();
++ par = (narg = strescseq.narg) ? atoi(STRESCARGJUST(0)) : 0;
+ switch (par) {
+ case 0:
+ if (narg > 1) {
+- xsettitle(strescseq.args[1]);
+- xseticontitle(strescseq.args[1]);
++ xsettitle(STRESCARGREST(1));
++ xseticontitle(STRESCARGREST(1));
+ }
+ return;
+ case 1:
+ if (narg > 1)
+- xseticontitle(strescseq.args[1]);
++ xseticontitle(STRESCARGREST(1));
+ return;
+ case 2:
+ if (narg > 1)
+- xsettitle(strescseq.args[1]);
++ xsettitle(STRESCARGREST(1));
+ return;
+ case 52:
+ if (narg > 2 && allowwindowops) {
+- dec = base64dec(strescseq.args[2]);
++ dec = base64dec(STRESCARGJUST(2));
+ if (dec) {
+ xsetsel(dec);
+ xclipcopy();
+_AT_@ -1920,7 +1923,7 @@ strhandle(void)
+ if (narg < 2)
+ break;
+
+- p = strescseq.args[1];
++ p = STRESCARGREST(1);
+
+ if (!strcmp(p, "?"))
+ osc_color_response(defaultfg, 10);
+_AT_@ -1933,7 +1936,7 @@ strhandle(void)
+ if (narg < 2)
+ break;
+
+- p = strescseq.args[1];
++ p = STRESCARGREST(1);
+
+ if (!strcmp(p, "?"))
+ osc_color_response(defaultbg, 11);
+_AT_@ -1946,7 +1949,7 @@ strhandle(void)
+ if (narg < 2)
+ break;
+
+- p = strescseq.args[1];
++ p = STRESCARGREST(1);
+
+ if (!strcmp(p, "?"))
+ osc_color_response(defaultcs, 12);
+_AT_@ -1958,10 +1961,10 @@ strhandle(void)
+ case 4: /* color set */
+ if (narg < 3)
+ break;
+- p = strescseq.args[2];
++ p = STRESCARGJUST(2);
+ /* FALLTHROUGH */
+ case 104: /* color reset */
+- j = (narg > 1) ? atoi(strescseq.args[1]) : -1;
++ j = (narg > 1) ? atoi(STRESCARGJUST(1)) : -1;
+
+ if (p && !strcmp(p, "?"))
+ osc4_color_response(j);
+_AT_@ -1981,7 +1984,7 @@ strhandle(void)
+ }
+ break;
+ case 'k': /* old title set compatibility */
+- xsettitle(strescseq.args[0]);
++ xsettitle(strescseq.buf);
+ return;
+ case 'P': /* DCS -- Device Control String */
+ case '_': /* APC -- Application Program Command */
+_AT_@ -2000,18 +2003,17 @@ strparse(void)
+ char *p = strescseq.buf;
+
+ strescseq.narg = 0;
+- strescseq.buf[strescseq.len] = '+
+ if (*p == '+ return;
+
+ while (strescseq.narg < STR_ARG_SIZ) {
+- strescseq.args[strescseq.narg++] = p;
+ while ((c = *p) != ';' && c != '+- ++p;
++ p++;
++ strescseq.argp[strescseq.narg++] = p;
+ if (c == '+ return;
+- *p++ = '++ p++;
+ }
+ }
+
+--
+2.37.1
+
Received on Sun Jul 17 2022 - 18:46:18 CEST
This archive was generated by hypermail 2.3.0
: Sun Jul 17 2022 - 18:48:38 CEST