From 37f8df882463431888dbaf205ce3ea6488cf4702 Mon Sep 17 00:00:00 2001 From: Björn Linse Date: Sun, 20 Jan 2019 21:23:17 +0100 Subject: UI: implement 'pumblend' option for semi-transparent popupmenu MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Why? - Because we can. - Because the TUI is just another GUI™ - Because it looks kinda nice, and provides useful context like 1 out of 100 times Complies with "don't pay for what you don't use". Some crashes for resizing were unfolded, add tests for those. --- src/nvim/screen.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src/nvim/screen.c') diff --git a/src/nvim/screen.c b/src/nvim/screen.c index 014f63f400..00d7c05be4 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -154,7 +154,7 @@ static bool highlights_invalid = false; static bool conceal_cursor_used = false; -static bool floats_invalid = false; +static bool redraw_popupmenu = false; #ifdef INCLUDE_GENERATED_DECLARATIONS # include "screen.c.generated.h" @@ -466,13 +466,13 @@ void update_screen(int type) end_search_hl(); // May need to redraw the popup menu. - if (pum_drawn() && floats_invalid) { + if (pum_drawn() && redraw_popupmenu) { pum_redraw(); } send_grid_resize = false; highlights_invalid = false; - floats_invalid = false; + redraw_popupmenu = false; /* Reset b_mod_set flags. Going through all windows is probably faster * than going through all buffers (there could be many buffers). */ @@ -6185,7 +6185,6 @@ static void screenclear2(void) default_grid.line_wraps[i] = false; } - floats_invalid = true; ui_call_grid_clear(1); // clear the display clear_cmdline = false; mode_displayed = false; @@ -6193,6 +6192,8 @@ static void screenclear2(void) redraw_all_later(NOT_VALID); redraw_cmdline = true; redraw_tabline = true; + redraw_popupmenu = true; + pum_invalidate(); if (must_redraw == CLEAR) { must_redraw = NOT_VALID; // no need to clear again } @@ -7196,6 +7197,10 @@ void screen_resize(int width, int height) } else { update_topline(); if (pum_drawn()) { + // TODO(bfredl): ins_compl_show_pum wants to redraw the screen first. + // For now make sure the nested update_screen(0) won't redraw the + // pum at the old position. Try to untangle this later. + redraw_popupmenu = false; ins_compl_show_pum(); } update_screen(NOT_VALID); -- cgit