mirror of
https://github.com/tmux/tmux.git
synced 2024-12-25 02:48:47 +00:00
Do not allow inline styles to replace mode-style for the selected item,
from Alexis Hildebrandt in GitHub issue 2946.
This commit is contained in:
parent
197a116f5a
commit
5745bd27fd
@ -677,7 +677,8 @@ format_draw_many(struct screen_write_ctx *ctx, struct style *sy, char ch,
|
|||||||
/* Draw a format to a screen. */
|
/* Draw a format to a screen. */
|
||||||
void
|
void
|
||||||
format_draw(struct screen_write_ctx *octx, const struct grid_cell *base,
|
format_draw(struct screen_write_ctx *octx, const struct grid_cell *base,
|
||||||
u_int available, const char *expanded, struct style_ranges *srs)
|
u_int available, const char *expanded, struct style_ranges *srs,
|
||||||
|
int default_colours)
|
||||||
{
|
{
|
||||||
enum { LEFT,
|
enum { LEFT,
|
||||||
CENTRE,
|
CENTRE,
|
||||||
@ -819,6 +820,10 @@ format_draw(struct screen_write_ctx *octx, const struct grid_cell *base,
|
|||||||
log_debug("%s: style '%s' -> '%s'", __func__, tmp,
|
log_debug("%s: style '%s' -> '%s'", __func__, tmp,
|
||||||
style_tostring(&sy));
|
style_tostring(&sy));
|
||||||
free(tmp);
|
free(tmp);
|
||||||
|
if (default_colours) {
|
||||||
|
sy.gc.bg = base->bg;
|
||||||
|
sy.gc.fg = base->fg;
|
||||||
|
}
|
||||||
|
|
||||||
/* If this style has a fill colour, store it for later. */
|
/* If this style has a fill colour, store it for later. */
|
||||||
if (sy.fill != 8)
|
if (sy.fill != 8)
|
||||||
|
@ -716,14 +716,14 @@ mode_tree_draw(struct mode_tree_data *mtd)
|
|||||||
screen_write_nputs(&ctx, w, &gc0, "%s", text);
|
screen_write_nputs(&ctx, w, &gc0, "%s", text);
|
||||||
if (mti->text != NULL) {
|
if (mti->text != NULL) {
|
||||||
format_draw(&ctx, &gc0, w - width, mti->text,
|
format_draw(&ctx, &gc0, w - width, mti->text,
|
||||||
NULL);
|
NULL, 0);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
screen_write_clearendofline(&ctx, gc.bg);
|
screen_write_clearendofline(&ctx, gc.bg);
|
||||||
screen_write_nputs(&ctx, w, &gc, "%s", text);
|
screen_write_nputs(&ctx, w, &gc, "%s", text);
|
||||||
if (mti->text != NULL) {
|
if (mti->text != NULL) {
|
||||||
format_draw(&ctx, &gc, w - width, mti->text,
|
format_draw(&ctx, &gc, w - width, mti->text,
|
||||||
NULL);
|
NULL, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
free(text);
|
free(text);
|
||||||
|
@ -400,7 +400,7 @@ screen_redraw_make_pane_status(struct client *c, struct window_pane *wp,
|
|||||||
gc.attr &= ~GRID_ATTR_CHARSET;
|
gc.attr &= ~GRID_ATTR_CHARSET;
|
||||||
|
|
||||||
screen_write_cursormove(&ctx, 0, 0, 0);
|
screen_write_cursormove(&ctx, 0, 0, 0);
|
||||||
format_draw(&ctx, &gc, width, expanded, NULL);
|
format_draw(&ctx, &gc, width, expanded, NULL, 0);
|
||||||
screen_write_stop(&ctx);
|
screen_write_stop(&ctx);
|
||||||
|
|
||||||
free(expanded);
|
free(expanded);
|
||||||
|
@ -665,10 +665,12 @@ screen_write_menu(struct screen_write_ctx *ctx, struct menu *menu,
|
|||||||
if (*name == '-') {
|
if (*name == '-') {
|
||||||
name++;
|
name++;
|
||||||
default_gc.attr |= GRID_ATTR_DIM;
|
default_gc.attr |= GRID_ATTR_DIM;
|
||||||
format_draw(ctx, gc, menu->width, name, NULL);
|
format_draw(ctx, gc, menu->width, name, NULL,
|
||||||
|
0);
|
||||||
default_gc.attr &= ~GRID_ATTR_DIM;
|
default_gc.attr &= ~GRID_ATTR_DIM;
|
||||||
} else
|
} else
|
||||||
format_draw(ctx, gc, menu->width, name, NULL);
|
format_draw(ctx, gc, menu->width, name, NULL,
|
||||||
|
gc == choice_gc);
|
||||||
gc = &default_gc;
|
gc = &default_gc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -764,7 +766,7 @@ screen_write_box(struct screen_write_ctx *ctx, u_int nx, u_int ny,
|
|||||||
if (title != NULL) {
|
if (title != NULL) {
|
||||||
gc.attr &= ~GRID_ATTR_CHARSET;
|
gc.attr &= ~GRID_ATTR_CHARSET;
|
||||||
screen_write_cursormove(ctx, cx + 2, cy, 0);
|
screen_write_cursormove(ctx, cx + 2, cy, 0);
|
||||||
format_draw(ctx, &gc, nx - 4, title, NULL);
|
format_draw(ctx, &gc, nx - 4, title, NULL, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
screen_write_set_cursor(ctx, cx, cy);
|
screen_write_set_cursor(ctx, cx, cy);
|
||||||
|
2
tmux.h
2
tmux.h
@ -2032,7 +2032,7 @@ char *format_grid_line(struct grid *, u_int);
|
|||||||
/* format-draw.c */
|
/* format-draw.c */
|
||||||
void format_draw(struct screen_write_ctx *,
|
void format_draw(struct screen_write_ctx *,
|
||||||
const struct grid_cell *, u_int, const char *,
|
const struct grid_cell *, u_int, const char *,
|
||||||
struct style_ranges *);
|
struct style_ranges *, int);
|
||||||
u_int format_width(const char *);
|
u_int format_width(const char *);
|
||||||
char *format_trim_left(const char *, u_int);
|
char *format_trim_left(const char *, u_int);
|
||||||
char *format_trim_right(const char *, u_int);
|
char *format_trim_right(const char *, u_int);
|
||||||
|
Loading…
Reference in New Issue
Block a user