summaryrefslogtreecommitdiff
path: root/st.c
diff options
context:
space:
mode:
authorMarcelo Lira <setanta@gmail.com>2025-03-02 03:36:46 -0300
committerMarcelo Lira <setanta@gmail.com>2025-03-02 08:31:10 -0300
commitd0ebad653b810fbdd9420ff172c238a5ec52eb1f (patch)
tree48294e79caba4076fb7287d1e13ecbb508a185a3 /st.c
parent5a7af3b20395d082693124f616b6d586919a97e2 (diff)
CSI 22, 23
This patch adds support for CSI escape sequences 22 and 23, which save and restore window title (for instance nvim does this when opening and closing). https://st.suckless.org/patches/csi_22_23/
Diffstat (limited to 'st.c')
-rw-r--r--st.c36
1 files changed, 32 insertions, 4 deletions
diff --git a/st.c b/st.c
index 663b20d..ef8a793 100644
--- a/st.c
+++ b/st.c
@@ -1817,6 +1817,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;
+ }
}
}
@@ -1895,7 +1922,7 @@ strhandle(void)
switch (par) {
case 0:
if (narg > 1) {
- xsettitle(strescseq.args[1]);
+ xsettitle(strescseq.args[1], 0);
xseticontitle(strescseq.args[1]);
}
return;
@@ -1905,7 +1932,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) {
@@ -1964,7 +1991,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 */
@@ -2336,6 +2363,7 @@ eschandle(uchar ascii)
break;
case 'c': /* RIS -- Reset to initial state */
treset();
+ xfreetitlestack();
resettitle();
xloadcols();
xsetmode(0, MODE_HIDE);
@@ -2631,7 +2659,7 @@ tresize(int col, int row)
void
resettitle(void)
{
- xsettitle(NULL);
+ xsettitle(NULL, 0);
}
void