From 03149bf7f62e2c92d0e60087c52604d2dd51794f Mon Sep 17 00:00:00 2001 From: nicm Date: Mon, 15 Aug 2022 08:54:03 +0000 Subject: [PATCH] Add a Nobr terminfo capability to tell tmux the terminal does not use bright colours for bold (makes a difference to how tmux applies palette differences). From Damien Tardy-Panis in GitHub issue 3301. --- tmux.1 | 4 ++++ tmux.h | 1 + tty-term.c | 1 + tty.c | 8 +++++--- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/tmux.1 b/tmux.1 index fa7fcbfb..b6283373 100644 --- a/tmux.1 +++ b/tmux.1 @@ -6430,6 +6430,10 @@ These are set automatically if the capability is present. .It Em \&Hls Set or clear a hyperlink annotation. +.It Em \&Nobr +Tell +.Nm +that the terminal does not use bright colors for bold display. .It Em \&Rect Tell .Nm diff --git a/tmux.h b/tmux.h index 4196a31c..413d8c38 100644 --- a/tmux.h +++ b/tmux.h @@ -514,6 +514,7 @@ enum tty_code_code { TTYC_KUP6, TTYC_KUP7, TTYC_MS, + TTYC_NOBR, TTYC_OL, TTYC_OP, TTYC_RECT, diff --git a/tty-term.c b/tty-term.c index a877ef6b..e3167f19 100644 --- a/tty-term.c +++ b/tty-term.c @@ -247,6 +247,7 @@ static const struct tty_term_code_entry tty_term_codes[] = { [TTYC_KUP6] = { TTYCODE_STRING, "kUP6" }, [TTYC_KUP7] = { TTYCODE_STRING, "kUP7" }, [TTYC_MS] = { TTYCODE_STRING, "Ms" }, + [TTYC_NOBR] = { TTYCODE_STRING, "Nobr" }, [TTYC_OL] = { TTYCODE_STRING, "ol" }, [TTYC_OP] = { TTYCODE_STRING, "op" }, [TTYC_RECT] = { TTYCODE_STRING, "Rect" }, diff --git a/tty.c b/tty.c index a7ad536f..1394075d 100644 --- a/tty.c +++ b/tty.c @@ -2690,12 +2690,14 @@ tty_check_fg(struct tty *tty, struct colour_palette *palette, /* * Perform substitution if this pane has a palette. If the bright - * attribute is set, use the bright entry in the palette by changing to - * the aixterm colour. + * attribute is set and Nobr is not present, use the bright entry in + * the palette by changing to the aixterm colour */ if (~gc->flags & GRID_FLAG_NOPALETTE) { c = gc->fg; - if (c < 8 && gc->attr & GRID_ATTR_BRIGHT) + if (c < 8 && + gc->attr & GRID_ATTR_BRIGHT && + !tty_term_has(tty->term, TTYC_NOBR)) c += 90; if ((c = colour_palette_get(palette, c)) != -1) gc->fg = c;