summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAyman Bagabas <ayman.bagabas@gmail.com>2025-08-08 17:11:59 -0400
committerHiltjo Posthuma <hiltjo@codemadness.org>2025-08-09 12:34:01 +0200
commitd6c431859c6c0201e0668ed24a9f17cebf0a68f5 (patch)
tree4413b35cd34646e44bea25e5871ab83ca79c7231
parentEat up "CSI 58" sequences (diff)
downloadst-d6c431859c6c0201e0668ed24a9f17cebf0a68f5.tar.gz
st-d6c431859c6c0201e0668ed24a9f17cebf0a68f5.zip
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. Signed-off-by: Ayman Bagabas <ayman.bagabas@gmail.com>
-rw-r--r--st.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/st.c b/st.c
index 37f38c5..e9fea17 100644
--- a/st.c
+++ b/st.c
@@ -1967,6 +1967,19 @@ strhandle(void)
1967 tfulldirt(); 1967 tfulldirt();
1968 } 1968 }
1969 return; 1969 return;
1970 case 110:
1971 case 111:
1972 case 112:
1973 if (narg != 1)
1974 break;
1975 if ((j = par - 110) < 0 || j >= LEN(osc_table))
1976 break; /* shouldn't be possible */
1977 if (xsetcolorname(osc_table[j].idx, NULL)) {
1978 fprintf(stderr, "erresc: %s color not found\n", osc_table[j].str);
1979 } else {
1980 tfulldirt();
1981 }
1982 return;
1970 } 1983 }
1971 break; 1984 break;
1972 case 'k': /* old title set compatibility */ 1985 case 'k': /* old title set compatibility */