Skip to content

Instantly share code, notes, and snippets.

@zchee
Created December 9, 2016 15:09
Show Gist options
  • Save zchee/610d51f9adad682bfef289672aa4a41a to your computer and use it in GitHub Desktop.
Save zchee/610d51f9adad682bfef289672aa4a41a to your computer and use it in GitHub Desktop.
avoid flashing of popupmnu patch for Neovim
diff --git a/src/nvim/edit.c b/src/nvim/edit.c
index 9d07878f..436d628c 100644
--- a/src/nvim/edit.c
+++ b/src/nvim/edit.c
@@ -2406,7 +2406,6 @@ static void ins_compl_upd_pum(void)
if (compl_match_array != NULL) {
h = curwin->w_cline_height;
- update_screen(0);
if (h != curwin->w_cline_height)
ins_compl_del_pum();
}
@@ -2476,9 +2475,6 @@ void ins_compl_show_pum(void)
/* Dirty hard-coded hack: remove any matchparen highlighting. */
do_cmdline_cmd("if exists('g:loaded_matchparen')|3match none|endif");
- /* Update the screen before drawing the popup menu over it. */
- update_screen(0);
-
if (compl_match_array == NULL) {
array_changed = true;
// Need to build the popup menu list.
@@ -2580,6 +2576,9 @@ void ins_compl_show_pum(void)
// part of the screen would be updated. We do need to redraw here.
dollar_vcol = -1;
+ /* Update the screen before drawing the popup menu over it. */
+ update_screen(0);
+
// Compute the screen column of the start of the completed text.
// Use the cursor to get all wrapping and other settings right.
col = curwin->w_cursor.col;
diff --git a/src/nvim/popupmnu.c b/src/nvim/popupmnu.c
index 947814de..f48c40d4 100644
--- a/src/nvim/popupmnu.c
+++ b/src/nvim/popupmnu.c
@@ -660,7 +660,7 @@ static int pum_set_selected(int n, int repeat)
// Return cursor to where we were
validate_cursor();
- redraw_later(SOME_VALID);
+ redraw_win_later(curwin, REDRAW_TOP);
// When the preview window was resized we need to
// update the view on the buffer. Only go back to
@@ -676,7 +676,7 @@ static int pum_set_selected(int n, int repeat)
// Update the screen before drawing the popup menu.
// Enable updating the status lines.
pum_is_visible = false;
- update_screen(0);
+ win_redr_status(curwin);
pum_is_visible = true;
if (!resized && win_valid(curwin_save)) {
@@ -688,7 +688,7 @@ static int pum_set_selected(int n, int repeat)
// May need to update the screen again when there are
// autocommands involved.
pum_is_visible = false;
- update_screen(0);
+ win_redr_status(curwin);
pum_is_visible = true;
}
}
@zchee
Copy link
Author

zchee commented Dec 9, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment