forked from aniani/vim
patch 8.1.2415: popup menu flickers if an info popup is used
Problem: Popup menu flickers if an info popup is used. (Nick Spoons) Solution: Set the pum_skip_redraw flag.
This commit is contained in:
@@ -36,8 +36,13 @@ static int pum_win_col;
|
|||||||
static int pum_win_wcol;
|
static int pum_win_wcol;
|
||||||
static int pum_win_width;
|
static int pum_win_width;
|
||||||
|
|
||||||
static int pum_do_redraw = FALSE; // do redraw anyway
|
// Some parts are not updated when a popup menu is visible. Setting this flag
|
||||||
static int pum_skip_redraw = FALSE; // skip redraw
|
// 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);
|
static int pum_set_selected(int n, int repeat);
|
||||||
|
|
||||||
@@ -377,7 +382,7 @@ pum_call_update_screen()
|
|||||||
int
|
int
|
||||||
pum_under_menu(int row, int col)
|
pum_under_menu(int row, int col)
|
||||||
{
|
{
|
||||||
return pum_skip_redraw
|
return pum_will_redraw
|
||||||
&& row >= pum_row
|
&& row >= pum_row
|
||||||
&& row < pum_row + pum_height
|
&& row < pum_row + pum_height
|
||||||
&& col >= pum_col - 1
|
&& col >= pum_col - 1
|
||||||
@@ -410,9 +415,11 @@ pum_redraw(void)
|
|||||||
if (call_update_screen)
|
if (call_update_screen)
|
||||||
{
|
{
|
||||||
call_update_screen = FALSE;
|
call_update_screen = FALSE;
|
||||||
pum_skip_redraw = TRUE; // do not redraw in pum_may_redraw().
|
// 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);
|
update_screen(0);
|
||||||
pum_skip_redraw = FALSE;
|
pum_will_redraw = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// never display more than we have
|
// never display more than we have
|
||||||
@@ -916,9 +923,13 @@ pum_set_selected(int n, int repeat UNUSED)
|
|||||||
|
|
||||||
// Update the screen before drawing the popup menu.
|
// Update the screen before drawing the popup menu.
|
||||||
// Enable updating the status lines.
|
// Enable updating the status lines.
|
||||||
pum_do_redraw = TRUE;
|
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);
|
update_screen(0);
|
||||||
pum_do_redraw = FALSE;
|
pum_pretend_not_visible = FALSE;
|
||||||
|
pum_will_redraw = FALSE;
|
||||||
|
|
||||||
if (!resized && win_valid(curwin_save))
|
if (!resized && win_valid(curwin_save))
|
||||||
{
|
{
|
||||||
@@ -936,9 +947,11 @@ pum_set_selected(int n, int repeat UNUSED)
|
|||||||
|
|
||||||
// May need to update the screen again when there are
|
// May need to update the screen again when there are
|
||||||
// autocommands involved.
|
// autocommands involved.
|
||||||
pum_do_redraw = TRUE;
|
pum_pretend_not_visible = TRUE;
|
||||||
|
pum_will_redraw = TRUE;
|
||||||
update_screen(0);
|
update_screen(0);
|
||||||
pum_do_redraw = FALSE;
|
pum_pretend_not_visible = FALSE;
|
||||||
|
pum_will_redraw = FALSE;
|
||||||
call_update_screen = FALSE;
|
call_update_screen = FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -990,13 +1003,14 @@ pum_clear(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Return TRUE if the popup menu is displayed.
|
* Return TRUE if the popup menu is displayed. Used to avoid some redrawing
|
||||||
* Overruled when "pum_do_redraw" is set, used to redraw the status lines.
|
* that could overwrite it. Overruled when "pum_pretend_not_visible" is set,
|
||||||
|
* used to redraw the status lines.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
pum_visible(void)
|
pum_visible(void)
|
||||||
{
|
{
|
||||||
return !pum_do_redraw && pum_array != NULL;
|
return !pum_pretend_not_visible && pum_array != NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -1009,7 +1023,7 @@ pum_may_redraw(void)
|
|||||||
int len = pum_size;
|
int len = pum_size;
|
||||||
int selected = pum_selected;
|
int selected = pum_selected;
|
||||||
|
|
||||||
if (!pum_visible() || pum_skip_redraw)
|
if (!pum_visible() || pum_will_redraw)
|
||||||
return; // nothing to do
|
return; // nothing to do
|
||||||
|
|
||||||
if (pum_window != curwin
|
if (pum_window != curwin
|
||||||
|
@@ -742,6 +742,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
2415,
|
||||||
/**/
|
/**/
|
||||||
2414,
|
2414,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user