To: vim_dev@googlegroups.com Subject: Patch 8.0.0390 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.0.0390 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 #1524) Files: src/edit.c *** ../vim-8.0.0389/src/edit.c 2017-02-26 19:09:01.394217154 +0100 --- src/edit.c 2017-03-01 12:23:55.272834262 +0100 *************** *** 186,192 **** static int ins_compl_key2count(int c); static int ins_compl_use_match(int c); static int ins_complete(int c, int enable_pum); ! static void show_pum(int save_w_wrow); static unsigned quote_meta(char_u *dest, char_u *str, int len); #endif /* FEAT_INS_EXPAND */ --- 186,192 ---- static int ins_compl_key2count(int c); static int ins_compl_use_match(int c); static int ins_complete(int c, int enable_pum); ! static void show_pum(int prev_w_wrow, int prev_w_leftcol); static unsigned quote_meta(char_u *dest, char_u *str, int len); #endif /* FEAT_INS_EXPAND */ *************** *** 2818,2823 **** --- 2818,2824 ---- set_completion(colnr_T startcol, list_T *list) { int save_w_wrow = curwin->w_wrow; + int save_w_leftcol = curwin->w_leftcol; /* If already doing completions stop it. */ if (ctrl_x_mode != 0) *************** *** 2858,2864 **** /* Lazily show the popup menu, unless we got interrupted. */ if (!compl_interrupted) ! show_pum(save_w_wrow); out_flush(); } --- 2859,2865 ---- /* Lazily show the popup menu, unless we got interrupted. */ if (!compl_interrupted) ! show_pum(save_w_wrow, save_w_leftcol); out_flush(); } *************** *** 5096,5101 **** --- 5097,5103 ---- colnr_T curs_col; /* cursor column */ int n; int save_w_wrow; + int save_w_leftcol; int insert_match; int save_did_ai = did_ai; *************** *** 5539,5544 **** --- 5541,5547 ---- * 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 */ *************** *** 5691,5699 **** /* Show the popup menu, unless we got interrupted. */ if (enable_pum && !compl_interrupted) ! { ! show_pum(save_w_wrow); ! } compl_was_interrupted = compl_interrupted; compl_interrupted = FALSE; --- 5694,5701 ---- /* Show the popup menu, unless we got interrupted. */ if (enable_pum && !compl_interrupted) ! show_pum(save_w_wrow, save_w_leftcol); ! compl_was_interrupted = compl_interrupted; compl_interrupted = FALSE; *************** *** 5701,5721 **** } static void ! show_pum(int save_w_wrow) { ! /* RedrawingDisabled may be set when invoked through complete(). */ ! int n = RedrawingDisabled; ! RedrawingDisabled = 0; ! /* If the cursor moved we need to remove the pum first. */ ! setcursor(); ! if (save_w_wrow != curwin->w_wrow) ! ins_compl_del_pum(); ! ins_compl_show_pum(); ! setcursor(); ! RedrawingDisabled = n; } /* --- 5703,5724 ---- } 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 or the display scrolled we need to remove the pum ! * first. */ ! setcursor(); ! if (prev_w_wrow != curwin->w_wrow || prev_w_leftcol != curwin->w_leftcol) ! ins_compl_del_pum(); ! ins_compl_show_pum(); ! setcursor(); ! RedrawingDisabled = n; } /* *** ../vim-8.0.0389/src/version.c 2017-02-28 22:51:08.468606327 +0100 --- src/version.c 2017-03-01 12:26:02.840006635 +0100 *************** *** 766,767 **** --- 766,769 ---- { /* Add new patch number below this line */ + /**/ + 390, /**/ -- hundred-and-one symptoms of being an internet addict: 30. Even though you died last week, you've managed to retain OPS on your favorite IRC channel. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///