Adding osc_10_11_12_2 patch ref. #21

This commit is contained in:
bakkeby 2021-05-08 16:50:06 +02:00
parent 8c8bace91c
commit a44ac5937f
3 changed files with 53 additions and 2 deletions

View File

@ -15,7 +15,7 @@ Refer to [https://st.suckless.org/](https://st.suckless.org/) for details on the
### Changelog:
2021-05-08 - Added blinking cursor, undercurl, desktopentry and netwmicon patches
2021-05-08 - Added blinking cursor, undercurl, desktopentry, netwmicon and osc_10_11_12_2 patches
2021-05-07 - Added xresources reload patch
@ -154,6 +154,14 @@ Refer to [https://st.suckless.org/](https://st.suckless.org/) for details on the
- [open-copied-url](https://st.suckless.org/patches/open_copied_url/)
- open contents of the clipboard in a user-defined browser
- [osc_10_11_12_2](https://st.suckless.org/patches/osc_10_11_12_2/)
- this patch adds support for OSC escape sequences 10, 11, and 12 in the way they are
implemented in most other terminals (e.g libvte, kitty)
- specifically it differs from [osc_10_11_12](https://st.suckless.org/patches/osc_10_11_12/)
in that it treats the background and foreground colors as distinct from palette colours 01
and 07 in order to facilitate the use of theme setting scripts like
[theme.sh](https://github.com/lemnos/theme.sh) which expect these colours to be distinct
- [relativeborder](https://st.suckless.org/patches/relativeborder/)
- allows you to specify a border that is relative in size to the width of a cell in the terminal

View File

@ -186,6 +186,16 @@
*/
#define OPENCOPIED_PATCH 0
/* This patch adds support for OSC escape sequences 10, 11 and 12 that modify the background,
* foreground and cursor colors in the way they are implemented in most other terminals
* (e.g libvte, kitty). Specifically it differs from https://st.suckless.org/patches/osc_10_11_12/
* in that it treats the background and foreground colors as distinct from palette colours
* 01 and 07 in order to facilitate the use of theme setting scripts like theme.sh
* (https://github.com/lemnos/theme.sh) which expect these colours to be distinct.
* https://st.suckless.org/patches/osc_10_11_12_2/
*/
#define OSC_10_11_12_2_PATCH 0
/* This patch allows you to specify a border that is relative in size to the width of a cell
* in the terminal.
* https://st.suckless.org/patches/relativeborder/

35
st.c
View File

@ -2140,10 +2140,43 @@ strhandle(void)
}
}
return;
case 4: /* color set */
case 10: /* foreground set */
#if OSC_10_11_12_2_PATCH
if (narg < 2)
break;
p = strescseq.args[1];
if (xsetcolorname(defaultfg, p))
fprintf(stderr, "erresc: invalid foreground color %d\n", p);
else
redraw();
break;
#endif // OSC_10_11_12_2_PATCH
case 11: /* background set */
#if OSC_10_11_12_2_PATCH
if (narg < 2)
break;
p = strescseq.args[1];
if (xsetcolorname(defaultbg, p))
fprintf(stderr, "erresc: invalid background color %d\n", p);
else
redraw();
break;
#endif // OSC_10_11_12_2_PATCH
case 12: /* cursor color */
#if OSC_10_11_12_2_PATCH
if (narg < 2)
break;
p = strescseq.args[1];
if (xsetcolorname(defaultcs, p))
fprintf(stderr, "erresc: invalid cursor color %d\n", p);
else
redraw();
break;
#endif // OSC_10_11_12_2_PATCH
case 4: /* color set */
if ((par == 4 && narg < 3) || narg < 2)
break;
p = strescseq.args[((par == 4) ? 2 : 1)];