From 55b343f69030c22fcd36b88d2af445acdd69b732 Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Wed, 7 Apr 2021 08:09:40 +0200 Subject: osc: implement OSC 17+19: change selection background/foreground colors And of course, we also implement the corresponding reset sequences, OSC 117+119. --- osc.c | 34 +++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) (limited to 'osc.c') 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; -- cgit v1.3