aboutsummaryrefslogtreecommitdiff
path: root/osc.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2021-04-07 06:09:40 +0000
committerDaniel Eklöf <daniel@ekloef.se>2021-04-08 08:43:36 +0000
commit55b343f69030c22fcd36b88d2af445acdd69b732 (patch)
treec819d9c96dcf1ed1df9310b0abe40217e1416502 /osc.c
parentMerge branch 'osc-11-alpha' (diff)
osc: implement OSC 17+19: change selection background/foreground colors
And of course, we also implement the corresponding reset sequences, OSC 117+119.
Diffstat (limited to 'osc.c')
-rw-r--r--osc.c34
1 files changed, 31 insertions, 3 deletions
diff --git a/osc.c b/osc.c
index 157272d9..f5aa86a2 100644
--- a/osc.c
+++ b/osc.c
@@ -679,8 +679,10 @@ osc_dispatch(struct terminal *term)
break;
case 10:
- case 11: {
- /* Set default foreground/background color */
+ case 11:
+ case 17:
+ case 19: {
+ /* Set default foreground/background/highlight-bg/highlight-fg color */
/* Client queried for current value */
if (strlen(string) == 1 && string[0] == '?') {
@@ -714,7 +716,11 @@ osc_dispatch(struct terminal *term)
}
LOG_DBG("change color definition for %s to %06x",
- param == 10 ? "foreground" : "background", color);
+ param == 10 ? "foreground" :
+ param == 11 ? "background" :
+ param == 17 ? "selection background" :
+ "selection foreground",
+ color);
switch (param) {
case 10:
@@ -726,6 +732,16 @@ osc_dispatch(struct terminal *term)
if (have_alpha)
term->colors.alpha = alpha;
break;
+
+ case 17:
+ term->colors.selection_bg = color;
+ term->colors.use_custom_selection = true;
+ break;
+
+ case 19:
+ term->colors.selection_fg = color;
+ term->colors.use_custom_selection = true;
+ break;
}
term_damage_view(term);
@@ -836,6 +852,18 @@ osc_dispatch(struct terminal *term)
term_damage_cursor(term);
break;
+ case 117:
+ LOG_DBG("resetting selection background color");
+ term->colors.selection_bg = term->conf->colors.selection_bg;
+ term->colors.use_custom_selection = term->conf->colors.use_custom.selection;
+ break;
+
+ case 119:
+ LOG_DBG("resetting selection foreground color");
+ term->colors.selection_fg = term->conf->colors.selection_fg;
+ term->colors.use_custom_selection = term->conf->colors.use_custom.selection;
+ break;
+
case 555:
osc_flash(term);
break;