summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Adam <thomas@xteddy.org>2023-09-02 12:01:09 +0100
committerThomas Adam <thomas@xteddy.org>2023-09-02 12:01:09 +0100
commit7ad29b98311b4961d203dc360e6a21f35dac9f97 (patch)
tree61d839b77916c8260b0e7c8c68f6ad549d74937b
parente7c829fc67c9b037402ad1624139de33665fb96b (diff)
parentd209fe9b1ef5cf135f86058942e3caa6f998038c (diff)
Merge branch 'obsd-master'
-rw-r--r--session.c4
-rw-r--r--tmux.110
-rw-r--r--tmux.h1
-rw-r--r--tty-features.c1
-rw-r--r--tty-term.c1
-rw-r--r--tty.c24
6 files changed, 31 insertions, 10 deletions
diff --git a/session.c b/session.c
index 300ab7c0..08233172 100644
--- a/session.c
+++ b/session.c
@@ -685,8 +685,10 @@ session_group_synchronize1(struct session *target, struct session *s)
TAILQ_INIT(&s->lastw);
TAILQ_FOREACH(wl, &old_lastw, sentry) {
wl2 = winlink_find_by_index(&s->windows, wl->idx);
- if (wl2 != NULL)
+ if (wl2 != NULL) {
TAILQ_INSERT_TAIL(&s->lastw, wl2, sentry);
+ wl2->flags |= WINLINK_VISITED;
+ }
}
/* Then free the old winlinks list. */
diff --git a/tmux.1 b/tmux.1
index 366fc51b..8c998f12 100644
--- a/tmux.1
+++ b/tmux.1
@@ -6805,9 +6805,15 @@ Set a styled underscore.
The single parameter is one of: 0 for no underscore, 1 for normal
underscore, 2 for double underscore, 3 for curly underscore, 4 for dotted
underscore and 5 for dashed underscore.
-.It Em \&Setulc , \&ol
+.It Em \&Setulc , \&Setulc1, \&ol
Set the underscore colour or reset to the default.
-The argument is (red * 65536) + (green * 256) + blue where each is between 0
+.Em Setulc
+is for RGB colours and
+.Em Setulc1
+for ANSI or 256 colours.
+The
+.Em Setulc
+argument is (red * 65536) + (green * 256) + blue where each is between 0
and 255.
.It Em \&Ss , Se
Set or reset the cursor style.
diff --git a/tmux.h b/tmux.h
index 3dd8e019..4ea56cd5 100644
--- a/tmux.h
+++ b/tmux.h
@@ -545,6 +545,7 @@ enum tty_code_code {
TTYC_SETRGBB,
TTYC_SETRGBF,
TTYC_SETULC,
+ TTYC_SETULC1,
TTYC_SGR0,
TTYC_SITM,
TTYC_SMACS,
diff --git a/tty-features.c b/tty-features.c
index dca40fad..dde13fe8 100644
--- a/tty-features.c
+++ b/tty-features.c
@@ -155,6 +155,7 @@ static const struct tty_feature tty_feature_overline = {
static const char *const tty_feature_usstyle_capabilities[] = {
"Smulx=\\E[4::%p1%dm",
"Setulc=\\E[58::2::%p1%{65536}%/%d::%p1%{256}%/%{255}%&%d::%p1%{255}%&%d%;m",
+ "Setulc1=\\E[58::5::%p1%dm",
"ol=\\E[59m",
NULL
};
diff --git a/tty-term.c b/tty-term.c
index e2242269..67face26 100644
--- a/tty-term.c
+++ b/tty-term.c
@@ -267,6 +267,7 @@ static const struct tty_term_code_entry tty_term_codes[] = {
[TTYC_SETRGBB] = { TTYCODE_STRING, "setrgbb" },
[TTYC_SETRGBF] = { TTYCODE_STRING, "setrgbf" },
[TTYC_SETULC] = { TTYCODE_STRING, "Setulc" },
+ [TTYC_SETULC1] = { TTYCODE_STRING, "Setulc1" },
[TTYC_SE] = { TTYCODE_STRING, "Se" },
[TTYC_SXL] = { TTYCODE_FLAG, "Sxl" },
[TTYC_SGR0] = { TTYCODE_STRING, "sgr0" },
diff --git a/tty.c b/tty.c
index 032bb967..8b0d4f5a 100644
--- a/tty.c
+++ b/tty.c
@@ -2936,11 +2936,13 @@ tty_check_us(__unused struct tty *tty, struct colour_palette *palette,
gc->us = c;
}
- /* Underscore colour is set as RGB so convert. */
- if ((c = colour_force_rgb (gc->us)) == -1)
- gc->us = 8;
- else
- gc->us = c;
+ /* Convert underscore colour if only RGB can be supported. */
+ if (!tty_term_has(tty->term, TTYC_SETULC1)) {
+ if ((c = colour_force_rgb (gc->us)) == -1)
+ gc->us = 8;
+ else
+ gc->us = c;
+ }
}
static void
@@ -3020,9 +3022,17 @@ tty_colours_us(struct tty *tty, const struct grid_cell *gc)
goto save;
}
- /* Must be an RGB colour - this should never happen. */
- if (~gc->us & COLOUR_FLAG_RGB)
+ /*
+ * If this is not an RGB colour, use Setulc1 if it exists, otherwise
+ * convert.
+ */
+ if (~gc->us & COLOUR_FLAG_RGB) {
+ c = gc->us;
+ if ((~c & COLOUR_FLAG_256) && (c >= 90 && c <= 97))
+ c -= 82;
+ tty_putcode_i(tty, TTYC_SETULC1, c & ~COLOUR_FLAG_256);
return;
+ }
/*
* Setulc and setal follows the ncurses(3) one argument "direct colour"