diff options
author | Tommy Allen <tommy@esdf.io> | 2017-03-01 08:08:05 -0500 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2017-03-01 14:08:05 +0100 |
commit | 410da0f6781ddf394f08c5027e2cb4b271f4a53e (patch) | |
tree | bc264b728992898d27719eb294573505f065ae53 | |
parent | 2872e57af26685cd485c7419ffaccee779927a1b (diff) | |
download | rneovim-410da0f6781ddf394f08c5027e2cb4b271f4a53e.tar.gz rneovim-410da0f6781ddf394f08c5027e2cb4b271f4a53e.tar.bz2 rneovim-410da0f6781ddf394f08c5027e2cb4b271f4a53e.zip |
vim-patch:8.0.0390 (#6197)
Problem: When the window scrolls horizontally when the popup menu is
displayed part of it may not be cleared. (Neovim issue #6184)
Solution: Remove the menu when the windows scrolled. (closes vim/vim#1524)
Fixes #6184
-rw-r--r-- | src/nvim/edit.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/nvim/edit.c b/src/nvim/edit.c index 0de8177467..edfd7e7460 100644 --- a/src/nvim/edit.c +++ b/src/nvim/edit.c @@ -2379,6 +2379,7 @@ void set_completion(colnr_T startcol, list_T *list) compl_used_match = TRUE; compl_cont_status = 0; int save_w_wrow = curwin->w_wrow; + int save_w_leftcol = curwin->w_leftcol; compl_curr_match = compl_first_match; if (compl_no_insert || compl_no_select) { @@ -2393,7 +2394,7 @@ void set_completion(colnr_T startcol, list_T *list) // Lazily show the popup menu, unless we got interrupted. if (!compl_interrupted) { - show_pum(save_w_wrow); + show_pum(save_w_wrow, save_w_leftcol); } ui_flush(); @@ -4338,6 +4339,7 @@ static int ins_complete(int c, bool enable_pum) colnr_T curs_col; /* cursor column */ int n; int save_w_wrow; + int save_w_leftcol; int insert_match; compl_direction = ins_compl_key2dir(c); @@ -4687,6 +4689,7 @@ static int ins_complete(int c, bool enable_pum) * Find next match (and following matches). */ save_w_wrow = curwin->w_wrow; + save_w_leftcol = curwin->w_leftcol; n = ins_compl_next(true, ins_compl_key2count(c), insert_match, false); /* may undisplay the popup menu */ @@ -4821,7 +4824,7 @@ static int ins_complete(int c, bool enable_pum) // Show the popup menu, unless we got interrupted. if (enable_pum && !compl_interrupted) { - show_pum(save_w_wrow); + show_pum(save_w_wrow, save_w_leftcol); } compl_was_interrupted = compl_interrupted; compl_interrupted = FALSE; @@ -8549,15 +8552,16 @@ static char_u *do_insert_char_pre(int c) return res; } -static void show_pum(int save_w_wrow) +static void show_pum(int prev_w_wrow, int prev_w_leftcol) { // RedrawingDisabled may be set when invoked through complete(). int n = RedrawingDisabled; RedrawingDisabled = 0; - // If the cursor moved we need to remove the pum first. + // If the cursor moved or the display scrolled we need to remove the pum + // first. setcursor(); - if (save_w_wrow != curwin->w_wrow) { + if (prev_w_wrow != curwin->w_wrow || prev_w_leftcol != curwin->w_leftcol) { ins_compl_del_pum(); } |