diff options
Diffstat (limited to 'usr.bin/tmux')
-rw-r--r-- | usr.bin/tmux/menu.c | 8 | ||||
-rw-r--r-- | usr.bin/tmux/screen-write.c | 27 | ||||
-rw-r--r-- | usr.bin/tmux/tmux.h | 5 |
3 files changed, 23 insertions, 17 deletions
diff --git a/usr.bin/tmux/menu.c b/usr.bin/tmux/menu.c index 822b11390e1..c6794509f83 100644 --- a/usr.bin/tmux/menu.c +++ b/usr.bin/tmux/menu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: menu.c,v 1.21 2020/04/13 18:59:41 nicm Exp $ */ +/* $OpenBSD: menu.c,v 1.22 2020/04/15 16:11:23 nicm Exp $ */ /* * Copyright (c) 2019 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -149,10 +149,14 @@ menu_draw_cb(struct client *c, __unused struct screen_redraw_ctx *ctx0) struct menu *menu = md->menu; struct screen_write_ctx ctx; u_int i, px = md->px, py = md->py; + struct grid_cell gc; + + memcpy(&gc, &grid_default_cell, sizeof gc); + style_apply(&gc, c->session->curw->window->options, "mode-style"); screen_write_start(&ctx, NULL, s); screen_write_clearscreen(&ctx, 8); - screen_write_menu(&ctx, menu, md->choice); + screen_write_menu(&ctx, menu, md->choice, &gc); screen_write_stop(&ctx); for (i = 0; i < screen_size_y(&md->s); i++) diff --git a/usr.bin/tmux/screen-write.c b/usr.bin/tmux/screen-write.c index 44033f64050..b065f27a024 100644 --- a/usr.bin/tmux/screen-write.c +++ b/usr.bin/tmux/screen-write.c @@ -1,4 +1,4 @@ -/* $OpenBSD: screen-write.c,v 1.160 2019/11/28 10:17:22 nicm Exp $ */ +/* $OpenBSD: screen-write.c,v 1.161 2020/04/15 16:11:23 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -409,21 +409,23 @@ screen_write_vline(struct screen_write_ctx *ctx, u_int ny, int top, int bottom) /* Draw a menu on screen. */ void -screen_write_menu(struct screen_write_ctx *ctx, struct menu *menu, int choice) +screen_write_menu(struct screen_write_ctx *ctx, struct menu *menu, + int choice, const struct grid_cell *choice_gc) { struct screen *s = ctx->s; - struct grid_cell gc; + struct grid_cell default_gc; + const struct grid_cell *gc = &default_gc; u_int cx, cy, i, j; const char *name; cx = s->cx; cy = s->cy; - memcpy(&gc, &grid_default_cell, sizeof gc); + memcpy(&default_gc, &grid_default_cell, sizeof default_gc); screen_write_box(ctx, menu->width + 4, menu->count + 2); screen_write_cursormove(ctx, cx + 2, cy, 0); - format_draw(ctx, &gc, menu->width, menu->title, NULL); + format_draw(ctx, &default_gc, menu->width, menu->title, NULL); for (i = 0; i < menu->count; i++) { name = menu->items[i].name; @@ -432,20 +434,19 @@ screen_write_menu(struct screen_write_ctx *ctx, struct menu *menu, int choice) screen_write_hline(ctx, menu->width + 4, 1, 1); } else { if (choice >= 0 && i == (u_int)choice && *name != '-') - gc.attr |= GRID_ATTR_REVERSE; + gc = choice_gc; screen_write_cursormove(ctx, cx + 2, cy + 1 + i, 0); for (j = 0; j < menu->width; j++) - screen_write_putc(ctx, &gc, ' '); + screen_write_putc(ctx, gc, ' '); screen_write_cursormove(ctx, cx + 2, cy + 1 + i, 0); if (*name == '-') { name++; - gc.attr |= GRID_ATTR_DIM; - format_draw(ctx, &gc, menu->width, name, NULL); - gc.attr &= ~GRID_ATTR_DIM; + default_gc.attr |= GRID_ATTR_DIM; + format_draw(ctx, gc, menu->width, name, NULL); + default_gc.attr &= ~GRID_ATTR_DIM; } else - format_draw(ctx, &gc, menu->width, name, NULL); - if (choice >= 0 && i == (u_int)choice) - gc.attr &= ~GRID_ATTR_REVERSE; + format_draw(ctx, gc, menu->width, name, NULL); + gc = &default_gc; } } diff --git a/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h index f33ec21cf19..2b7919f7dec 100644 --- a/usr.bin/tmux/tmux.h +++ b/usr.bin/tmux/tmux.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tmux.h,v 1.992 2020/04/15 12:59:20 nicm Exp $ */ +/* $OpenBSD: tmux.h,v 1.993 2020/04/15 16:11:23 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -2382,7 +2382,8 @@ void screen_write_fast_copy(struct screen_write_ctx *, struct screen *, u_int, u_int, u_int, u_int); void screen_write_hline(struct screen_write_ctx *, u_int, int, int); void screen_write_vline(struct screen_write_ctx *, u_int, int, int); -void screen_write_menu(struct screen_write_ctx *, struct menu *, int); +void screen_write_menu(struct screen_write_ctx *, struct menu *, int, + const struct grid_cell *); void screen_write_box(struct screen_write_ctx *, u_int, u_int); void screen_write_preview(struct screen_write_ctx *, struct screen *, u_int, u_int); |