From: nicm Date: Mon, 15 Aug 2022 08:54:03 +0000 (+0000) Subject: Add a Nobr terminfo capability to tell tmux the terminal does not use X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=306ef6055173613d9c2ce5ecef22e04644ff15bb;p=openbsd 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. --- diff --git a/usr.bin/tmux/tmux.1 b/usr.bin/tmux/tmux.1 index c9f28d3157c..38ea1241e02 100644 --- a/usr.bin/tmux/tmux.1 +++ b/usr.bin/tmux/tmux.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: tmux.1,v 1.897 2022/08/02 11:09:26 nicm Exp $ +.\" $OpenBSD: tmux.1,v 1.898 2022/08/15 08:54:03 nicm Exp $ .\" .\" Copyright (c) 2007 Nicholas Marriott .\" @@ -14,7 +14,7 @@ .\" IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING .\" OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: August 2 2022 $ +.Dd $Mdocdate: August 15 2022 $ .Dt TMUX 1 .Os .Sh NAME @@ -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/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h index cabf7e45f3a..81b208db68e 100644 --- a/usr.bin/tmux/tmux.h +++ b/usr.bin/tmux/tmux.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tmux.h,v 1.1179 2022/08/02 11:09:26 nicm Exp $ */ +/* $OpenBSD: tmux.h,v 1.1180 2022/08/15 08:54:03 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -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/usr.bin/tmux/tty-term.c b/usr.bin/tmux/tty-term.c index 197c50f0219..1f100e99f9b 100644 --- a/usr.bin/tmux/tty-term.c +++ b/usr.bin/tmux/tty-term.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty-term.c,v 1.93 2022/06/30 09:55:53 nicm Exp $ */ +/* $OpenBSD: tty-term.c,v 1.94 2022/08/15 08:54:03 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott @@ -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/usr.bin/tmux/tty.c b/usr.bin/tmux/tty.c index 4077b9ad528..77ffddb008e 100644 --- a/usr.bin/tmux/tty.c +++ b/usr.bin/tmux/tty.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty.c,v 1.423 2022/08/02 11:09:26 nicm Exp $ */ +/* $OpenBSD: tty.c,v 1.424 2022/08/15 08:54:03 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -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;