From 04033add19a91ffce9e8495c27cae3049fc306c6 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Wed, 29 Apr 2020 15:26:49 +0100 Subject: [PATCH] Close menu on backspace with TAB flag. --- menu.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/menu.c b/menu.c index c6962036..e265bf90 100644 --- a/menu.c +++ b/menu.c @@ -150,8 +150,11 @@ menu_draw_cb(struct client *c, __unused struct screen_redraw_ctx *ctx0) struct screen_write_ctx ctx; u_int i, px = md->px, py = md->py; struct grid_cell gc; + struct format_tree *ft; - style_apply(&gc, c->session->curw->window->options, "mode-style", NULL); + ft = format_create_from_state(md->item, c, &md->fs); + style_apply(&gc, c->session->curw->window->options, "mode-style", ft); + format_free(ft); screen_write_start(&ctx, NULL, s); screen_write_clearscreen(&ctx, 8); @@ -240,6 +243,10 @@ menu_key_cb(struct client *c, struct key_event *event) } while ((name == NULL || *name == '-') && md->choice != old); c->flags |= CLIENT_REDRAWOVERLAY; return (0); + case KEYC_BSPACE: + if (~md->flags & MENU_TAB) + break; + return (1); case '\011': /* Tab */ if (~md->flags & MENU_TAB) break;