mirror of
https://github.com/tmux/tmux.git
synced 2026-10-13 06:04:34 +00:00
Respect the ncv capability and do not combine attributes and colours
that will not work, reported by Joan Bruguera Micó in GitHub issue 5727.
This commit is contained in:
3
tmux.h
3
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 <nicholas.marriott@gmail.com>
|
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||||
@@ -629,6 +629,7 @@ enum tty_code_code {
|
|||||||
TTYC_KUP6,
|
TTYC_KUP6,
|
||||||
TTYC_KUP7,
|
TTYC_KUP7,
|
||||||
TTYC_MS,
|
TTYC_MS,
|
||||||
|
TTYC_NCV,
|
||||||
TTYC_NOBR,
|
TTYC_NOBR,
|
||||||
TTYC_OL,
|
TTYC_OL,
|
||||||
TTYC_OP,
|
TTYC_OP,
|
||||||
|
|||||||
@@ -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 <nicholas.marriott@gmail.com>
|
* Copyright (c) 2008 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||||
@@ -251,6 +251,7 @@ static const struct tty_term_code_entry tty_term_codes[] = {
|
|||||||
[TTYC_KUP6] = { TTYCODE_STRING, "kUP6" },
|
[TTYC_KUP6] = { TTYCODE_STRING, "kUP6" },
|
||||||
[TTYC_KUP7] = { TTYCODE_STRING, "kUP7" },
|
[TTYC_KUP7] = { TTYCODE_STRING, "kUP7" },
|
||||||
[TTYC_MS] = { TTYCODE_STRING, "Ms" },
|
[TTYC_MS] = { TTYCODE_STRING, "Ms" },
|
||||||
|
[TTYC_NCV] = { TTYCODE_NUMBER, "ncv" },
|
||||||
[TTYC_NOBR] = { TTYCODE_STRING, "Nobr" },
|
[TTYC_NOBR] = { TTYCODE_STRING, "Nobr" },
|
||||||
[TTYC_OL] = { TTYCODE_STRING, "ol" },
|
[TTYC_OL] = { TTYCODE_STRING, "ol" },
|
||||||
[TTYC_OP] = { TTYCODE_STRING, "op" },
|
[TTYC_OP] = { TTYCODE_STRING, "op" },
|
||||||
|
|||||||
31
tty.c
31
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 <nicholas.marriott@gmail.com>
|
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||||
@@ -51,6 +51,7 @@ static void tty_check_bg(struct tty *, struct colour_palette *,
|
|||||||
struct grid_cell *);
|
struct grid_cell *);
|
||||||
static void tty_check_us(struct tty *, struct colour_palette *,
|
static void tty_check_us(struct tty *, struct colour_palette *,
|
||||||
struct grid_cell *);
|
struct grid_cell *);
|
||||||
|
static void tty_check_ncv(struct tty *, struct grid_cell *);
|
||||||
static int tty_map_theme_colour(struct tty *, int);
|
static int tty_map_theme_colour(struct tty *, int);
|
||||||
static void tty_colours_fg(struct tty *, const struct grid_cell *);
|
static void tty_colours_fg(struct tty *, const struct grid_cell *);
|
||||||
static void tty_colours_bg(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);
|
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
|
void
|
||||||
tty_attributes(struct tty *tty, const struct grid_cell *gc,
|
tty_attributes(struct tty *tty, const struct grid_cell *gc,
|
||||||
const struct tty_style_ctx *style_ctx)
|
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_fg(tty, palette, &gc2);
|
||||||
tty_check_bg(tty, palette, &gc2);
|
tty_check_bg(tty, palette, &gc2);
|
||||||
tty_check_us(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,
|
* If any bits are being cleared or the underline colour is now default,
|
||||||
|
|||||||
Reference in New Issue
Block a user