To: vim_dev@googlegroups.com Subject: Patch 8.1.2415 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.2415 Problem: Popup menu flickers if an info popup is used. (Nick Spoons) Solution: Set the pum_skip_redraw flag. Files: src/popupmenu.c *** ../vim-8.1.2414/src/popupmenu.c 2019-12-06 20:17:20.379094586 +0100 --- src/popupmenu.c 2019-12-10 21:50:04.068877290 +0100 *************** *** 36,43 **** static int pum_win_wcol; static int pum_win_width; ! static int pum_do_redraw = FALSE; // do redraw anyway ! static int pum_skip_redraw = FALSE; // skip redraw static int pum_set_selected(int n, int repeat); --- 36,48 ---- static int pum_win_wcol; static int pum_win_width; ! // Some parts are not updated when a popup menu is visible. Setting this flag ! // makes pum_visible() return FALSE even when there is a popup menu. ! static int pum_pretend_not_visible = FALSE; ! ! // When set the popup menu will redraw soon using the pum_win_ values. Do not ! // draw over the poup menu area to avoid flicker. ! static int pum_will_redraw = FALSE; static int pum_set_selected(int n, int repeat); *************** *** 377,383 **** int pum_under_menu(int row, int col) { ! return pum_skip_redraw && row >= pum_row && row < pum_row + pum_height && col >= pum_col - 1 --- 382,388 ---- int pum_under_menu(int row, int col) { ! return pum_will_redraw && row >= pum_row && row < pum_row + pum_height && col >= pum_col - 1 *************** *** 410,418 **** if (call_update_screen) { call_update_screen = FALSE; ! pum_skip_redraw = TRUE; // do not redraw in pum_may_redraw(). update_screen(0); ! pum_skip_redraw = FALSE; } // never display more than we have --- 415,425 ---- if (call_update_screen) { call_update_screen = FALSE; ! // Do not redraw in pum_may_redraw() and don't draw in the area where ! // the popup menu will be. ! pum_will_redraw = TRUE; update_screen(0); ! pum_will_redraw = FALSE; } // never display more than we have *************** *** 916,924 **** // Update the screen before drawing the popup menu. // Enable updating the status lines. ! pum_do_redraw = TRUE; update_screen(0); ! pum_do_redraw = FALSE; if (!resized && win_valid(curwin_save)) { --- 923,935 ---- // Update the screen before drawing the popup menu. // Enable updating the status lines. ! pum_pretend_not_visible = TRUE; ! // But don't draw text at the new popup menu position, ! // it causes flicker. ! pum_will_redraw = TRUE; update_screen(0); ! pum_pretend_not_visible = FALSE; ! pum_will_redraw = FALSE; if (!resized && win_valid(curwin_save)) { *************** *** 936,944 **** // May need to update the screen again when there are // autocommands involved. ! pum_do_redraw = TRUE; update_screen(0); ! pum_do_redraw = FALSE; call_update_screen = FALSE; } } --- 947,957 ---- // May need to update the screen again when there are // autocommands involved. ! pum_pretend_not_visible = TRUE; ! pum_will_redraw = TRUE; update_screen(0); ! pum_pretend_not_visible = FALSE; ! pum_will_redraw = FALSE; call_update_screen = FALSE; } } *************** *** 990,1002 **** } /* ! * Return TRUE if the popup menu is displayed. ! * Overruled when "pum_do_redraw" is set, used to redraw the status lines. */ int pum_visible(void) { ! return !pum_do_redraw && pum_array != NULL; } /* --- 1003,1016 ---- } /* ! * Return TRUE if the popup menu is displayed. Used to avoid some redrawing ! * that could overwrite it. Overruled when "pum_pretend_not_visible" is set, ! * used to redraw the status lines. */ int pum_visible(void) { ! return !pum_pretend_not_visible && pum_array != NULL; } /* *************** *** 1009,1015 **** int len = pum_size; int selected = pum_selected; ! if (!pum_visible() || pum_skip_redraw) return; // nothing to do if (pum_window != curwin --- 1023,1029 ---- int len = pum_size; int selected = pum_selected; ! if (!pum_visible() || pum_will_redraw) return; // nothing to do if (pum_window != curwin *** ../vim-8.1.2414/src/version.c 2019-12-09 22:22:46.006488794 +0100 --- src/version.c 2019-12-10 21:50:24.384799242 +0100 *************** *** 744,745 **** --- 744,747 ---- { /* Add new patch number below this line */ + /**/ + 2415, /**/ -- Marriage isn't a word. It's a sentence. /// 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 ///