From bdb21ddb8bdffa372b2870407a2869d5c5a822f3 Mon Sep 17 00:00:00 2001 From: Bakkeby Date: Sun, 10 Aug 2025 15:44:48 +0200 Subject: [PATCH] bump version to 0.9.3 https://git.suckless.org/st/commit/5a4666c19e3956069147aee43a06b326d998366e.html add a few comments https://git.suckless.org/st/commit/5a4666c19e3956069147aee43a06b326d998366e.html Support OSC 110, 111, and 112 for resetting colors This adds support for OSC 110, 111, and 112 escape sequences to reset the foreground, background, and cursor colors in the terminal. The changes include handling these sequences in the `strhandle` function of `st.c`, allowing applications to reset colors to their default values. The OSC sequences originated from Xterm control sequences and are now widely used in terminal applications and supported by many terminal emulators. For applications, this allows them to reset colors to default values without needing to know the colors beforehand. https://git.suckless.org/st/commit/d6c431859c6c0201e0668ed24a9f17cebf0a68f5.html --- README.md | 2 +- config.mk | 2 +- st.c | 33 +++++++++++++++++++++++---------- 3 files changed, 25 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 0b46f59..92f9889 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -Similar to [dwm-flexipatch](https://github.com/bakkeby/dwm-flexipatch) this st 0.9.2 (f114bce, 2025-07-27) project has a different take on st patching. It uses preprocessor directives to decide whether or not to include a patch during build time. Essentially this means that this build, for better or worse, contains both the patched _and_ the original code. The aim being that you can select which patches to include and the build will contain that code and nothing more. +Similar to [dwm-flexipatch](https://github.com/bakkeby/dwm-flexipatch) this st 0.9.3 (6e97047, 2025-08-09) project has a different take on st patching. It uses preprocessor directives to decide whether or not to include a patch during build time. Essentially this means that this build, for better or worse, contains both the patched _and_ the original code. The aim being that you can select which patches to include and the build will contain that code and nothing more. For example to include the `alpha` patch then you would only need to flip this setting from 0 to 1 in [patches.h](https://github.com/bakkeby/st-flexipatch/blob/master/patches.def.h): ```c diff --git a/config.mk b/config.mk index 7becffc..a3b94cd 100644 --- a/config.mk +++ b/config.mk @@ -1,5 +1,5 @@ # st version -VERSION = 0.9.2 +VERSION = 0.9.3 # Customize below to fit your system diff --git a/st.c b/st.c index 74dac7d..0d56e00 100644 --- a/st.c +++ b/st.c @@ -1837,7 +1837,7 @@ tsetattr(const int *attr, int l) term.c.attr.fg = idx; #endif // MONOCHROME_PATCH break; - case 39: + case 39: /* set foreground color to default */ term.c.attr.fg = defaultfg; break; case 48: @@ -1848,7 +1848,7 @@ tsetattr(const int *attr, int l) term.c.attr.bg = idx; #endif // MONOCHROME_PATCH break; - case 49: + case 49: /* set background color to default */ term.c.attr.bg = defaultbg; break; #if UNDERCURL_PATCH @@ -1985,7 +1985,7 @@ tsetmode(int priv, int set, const int *args, int narg) case 1006: /* 1006: extended reporting mode */ xsetmode(set, MODE_MOUSESGR); break; - case 1034: + case 1034: /* 1034: enable 8-bit mode for keyboard input */ xsetmode(set, MODE_8BIT); break; case 1049: /* swap screen & set/restore cursor as xterm */ @@ -1993,8 +1993,8 @@ tsetmode(int priv, int set, const int *args, int narg) break; tcursor((set) ? CURSOR_SAVE : CURSOR_LOAD); /* FALLTHROUGH */ - case 47: /* swap screen */ - case 1047: + case 47: /* swap screen buffer */ + case 1047: /* swap screen buffer */ if (!allowaltscreen) break; #if REFLOW_PATCH @@ -2018,7 +2018,7 @@ tsetmode(int priv, int set, const int *args, int narg) break; /* FALLTHROUGH */ #endif // REFLOW_PATCH - case 1048: + case 1048: /* save/restore cursor (like DECSC/DECRC) */ #if REFLOW_PATCH if (!allowaltscreen) break; @@ -2656,7 +2656,7 @@ strhandle(void) xsettitle(strescseq.args[1]); #endif // CSI_22_23_PATCH return; - case 52: + case 52: /* manipulate selection data */ if (narg > 2 && allowwindowops) { dec = base64dec(strescseq.args[2]); if (dec) { @@ -2674,9 +2674,9 @@ strhandle(void) #endif // OSC7_PATCH case 8: /* Clear Hyperlinks */ return; - case 10: - case 11: - case 12: + case 10: /* set dynamic VT100 text foreground color */ + case 11: /* set dynamic VT100 text background color */ + case 12: /* set dynamic text cursor color */ if (narg < 2) break; p = strescseq.args[1]; @@ -2717,6 +2717,19 @@ strhandle(void) tfulldirt(); } return; + case 110: /* reset dynamic VT100 text foreground color */ + case 111: /* reset dynamic VT100 text background color */ + case 112: /* reset dynamic text cursor color */ + if (narg != 1) + break; + if ((j = par - 110) < 0 || j >= LEN(osc_table)) + break; /* shouldn't be possible */ + if (xsetcolorname(osc_table[j].idx, NULL)) { + fprintf(stderr, "erresc: %s color not found\n", osc_table[j].str); + } else { + tfulldirt(); + } + return; #if OSC133_PATCH case 133: if (narg < 2)