diff options
author | Björn Linse <bjorn.linse@gmail.com> | 2019-01-20 21:23:17 +0100 |
---|---|---|
committer | Björn Linse <bjorn.linse@gmail.com> | 2019-02-07 16:43:51 +0100 |
commit | 37f8df882463431888dbaf205ce3ea6488cf4702 (patch) | |
tree | 4ebb1634d1d0e16ae3d16d56c22e63602ef0efe4 /src/nvim/screen.c | |
parent | ed0e96cd28f870c4a580c9e8ab74340fecc90fcb (diff) | |
download | rneovim-37f8df882463431888dbaf205ce3ea6488cf4702.tar.gz rneovim-37f8df882463431888dbaf205ce3ea6488cf4702.tar.bz2 rneovim-37f8df882463431888dbaf205ce3ea6488cf4702.zip |
UI: implement 'pumblend' option for semi-transparent popupmenu
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.
Diffstat (limited to 'src/nvim/screen.c')
-rw-r--r-- | src/nvim/screen.c | 13 |
1 files changed, 9 insertions, 4 deletions
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); |