mirror of
https://github.com/tmux/tmux.git
synced 2026-10-11 13:04:22 +00:00
Merge branch 'obsd-master'
This commit is contained in:
29
tty.c
29
tty.c
@@ -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 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 *);
|
||||
static void tty_colours_us(struct tty *, const struct grid_cell *);
|
||||
@@ -2641,6 +2642,9 @@ tty_attributes(struct tty *tty, const struct grid_cell *gc,
|
||||
gc2.bg = changed;
|
||||
}
|
||||
}
|
||||
gc2.fg = tty_map_theme_colour(tty, gc2.fg);
|
||||
gc2.bg = tty_map_theme_colour(tty, gc2.bg);
|
||||
gc2.us = tty_map_theme_colour(tty, gc2.us);
|
||||
if (style_ctx->dim != 0) {
|
||||
gc2.fg = tty_dim_default_colour(tty, gc2.fg, 1);
|
||||
gc2.bg = tty_dim_default_colour(tty, gc2.bg, 0);
|
||||
@@ -2790,6 +2794,28 @@ tty_colours(struct tty *tty, const struct grid_cell *gc)
|
||||
tty_colours_us(tty, gc);
|
||||
}
|
||||
|
||||
static int
|
||||
tty_map_theme_colour(struct tty *tty, int colour)
|
||||
{
|
||||
struct client *c;
|
||||
u_int n;
|
||||
int m;
|
||||
|
||||
if (~colour & COLOUR_FLAG_THEME)
|
||||
return (colour);
|
||||
|
||||
n = colour & 0xff;
|
||||
if (n >= COLOUR_THEME_COUNT)
|
||||
return (8);
|
||||
if (tty == NULL || (c = tty->client) == NULL)
|
||||
return (8);
|
||||
|
||||
m = c->theme_colours[n];
|
||||
if (m == -1 || (m & COLOUR_FLAG_THEME))
|
||||
return (8);
|
||||
return (m);
|
||||
}
|
||||
|
||||
static void
|
||||
tty_check_fg(struct tty *tty, struct colour_palette *palette,
|
||||
struct grid_cell *gc)
|
||||
@@ -2812,6 +2838,7 @@ tty_check_fg(struct tty *tty, struct colour_palette *palette,
|
||||
if ((c = colour_palette_get(palette, c)) != -1)
|
||||
gc->fg = c;
|
||||
}
|
||||
gc->fg = tty_map_theme_colour(tty, gc->fg);
|
||||
|
||||
/* Is this a 24-bit colour? */
|
||||
if (gc->fg & COLOUR_FLAG_RGB) {
|
||||
@@ -2872,6 +2899,7 @@ tty_check_bg(struct tty *tty, struct colour_palette *palette,
|
||||
if ((c = colour_palette_get(palette, gc->bg)) != -1)
|
||||
gc->bg = c;
|
||||
}
|
||||
gc->bg = tty_map_theme_colour(tty, gc->bg);
|
||||
|
||||
/* Is this a 24-bit colour? */
|
||||
if (gc->bg & COLOUR_FLAG_RGB) {
|
||||
@@ -2922,6 +2950,7 @@ tty_check_us(__unused struct tty *tty, struct colour_palette *palette,
|
||||
if ((c = colour_palette_get(palette, gc->us)) != -1)
|
||||
gc->us = c;
|
||||
}
|
||||
gc->us = tty_map_theme_colour(tty, gc->us);
|
||||
|
||||
/* Convert underscore colour if only RGB can be supported. */
|
||||
if (!tty_term_has(tty->term, TTYC_SETULC1)) {
|
||||
|
||||
Reference in New Issue
Block a user