diff --git a/tmux.h b/tmux.h index fdea4145a..65bd00761 100644 --- a/tmux.h +++ b/tmux.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tmux.h,v 1.1455 2026/10/09 13:12:14 nicm Exp $ */ +/* $OpenBSD: tmux.h,v 1.1456 2026/10/12 10:39:05 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -629,6 +629,7 @@ enum tty_code_code { TTYC_KUP6, TTYC_KUP7, TTYC_MS, + TTYC_NCV, TTYC_NOBR, TTYC_OL, TTYC_OP, diff --git a/tty-term.c b/tty-term.c index f2d8b67b6..e34a872b4 100644 --- a/tty-term.c +++ b/tty-term.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty-term.c,v 1.111 2026/09/22 14:10:26 nicm Exp $ */ +/* $OpenBSD: tty-term.c,v 1.112 2026/10/12 10:39:05 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott @@ -251,6 +251,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_NCV] = { TTYCODE_NUMBER, "ncv" }, [TTYC_NOBR] = { TTYCODE_STRING, "Nobr" }, [TTYC_OL] = { TTYCODE_STRING, "ol" }, [TTYC_OP] = { TTYCODE_STRING, "op" }, diff --git a/tty.c b/tty.c index 161747655..ad2853d42 100644 --- a/tty.c +++ b/tty.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty.c,v 1.485 2026/10/07 07:34:59 nicm Exp $ */ +/* $OpenBSD: tty.c,v 1.486 2026/10/12 10:39:05 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -51,6 +51,7 @@ static void tty_check_bg(struct tty *, struct colour_palette *, struct grid_cell *); static void tty_check_us(struct tty *, struct colour_palette *, struct grid_cell *); +static void tty_check_ncv(struct tty *, struct grid_cell *); static int tty_map_theme_colour(struct tty *, int); static void tty_colours_fg(struct tty *, const struct grid_cell *); static void tty_colours_bg(struct tty *, const struct grid_cell *); @@ -2350,6 +2351,33 @@ tty_dim_default_colour(struct tty *tty, int c, int foreground) return (c); } +static void +tty_check_ncv(struct tty *tty, struct grid_cell *gc) +{ + int n; + + if (COLOUR_DEFAULT(gc->fg) && COLOUR_DEFAULT(gc->bg)) + return; + + n = tty_term_number(tty->term, TTYC_NCV); + if (n & 2) + gc->attr &= ~GRID_ATTR_ALL_UNDERSCORE; + if (n & 4) + gc->attr &= ~GRID_ATTR_REVERSE; + if (n & 8) + gc->attr &= ~GRID_ATTR_BLINK; + if (n & 16) + gc->attr &= ~GRID_ATTR_DIM; + if (n & 32) + gc->attr &= ~GRID_ATTR_BRIGHT; + if (n & 64) + gc->attr &= ~GRID_ATTR_HIDDEN; + if (n & 256) + gc->attr &= ~GRID_ATTR_CHARSET; + if (n & 32768) + gc->attr &= ~GRID_ATTR_ITALICS; +} + void tty_attributes(struct tty *tty, const struct grid_cell *gc, const struct tty_style_ctx *style_ctx) @@ -2420,6 +2448,7 @@ tty_attributes(struct tty *tty, const struct grid_cell *gc, tty_check_fg(tty, palette, &gc2); tty_check_bg(tty, palette, &gc2); tty_check_us(tty, palette, &gc2); + tty_check_ncv(tty, &gc2); /* * If any bits are being cleared or the underline colour is now default,