Patch 7.4.1405
Problem: Completion menu flickers.
Solution: Delay showing the popup menu. (Shougo, Justin M. Keyes, closes
#656)
Files: src/edit.c
*** ../vim-7.4.1404/src/edit.c 2016-02-16 20:09:07.865342593 +0100
--- src/edit.c 2016-02-23 20:10:43.558344423 +0100
***************
*** 185,191 ****
static int ins_compl_pum_key(int c);
static int ins_compl_key2count(int c);
static int ins_compl_use_match(int c);
! static int ins_complete(int c);
static unsigned quote_meta(char_u *dest, char_u *str, int len);
#endif /* FEAT_INS_EXPAND */
--- 185,192 ----
static int ins_compl_pum_key(int c);
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 */
***************
*** 1429,1435 ****
docomplete:
compl_busy = TRUE;
! if (ins_complete(c) == FAIL)
compl_cont_status = 0;
compl_busy = FALSE;
break;
--- 1430,1436 ----
docomplete:
compl_busy = TRUE;
! if (ins_complete(c, TRUE) == FAIL)
compl_cont_status = 0;
compl_busy = FALSE;
break;
***************
*** 2765,2770 ****
--- 2766,2773 ----
void
set_completion(colnr_T startcol, list_T *list)
{
+ int save_w_wrow = curwin->w_wrow;
+
/* If already doing completions stop it. */
if (ctrl_x_mode != 0)
ins_compl_prep(' ');
***************
*** 2794,2804 ****
compl_curr_match = compl_first_match;
if (compl_no_insert)
! ins_complete(K_DOWN);
else
! ins_complete(Ctrl_N);
if (compl_no_select)
! ins_complete(Ctrl_P);
out_flush();
}
--- 2797,2811 ----
compl_curr_match = compl_first_match;
if (compl_no_insert)
! ins_complete(K_DOWN, FALSE);
else
! ins_complete(Ctrl_N, FALSE);
if (compl_no_select)
! ins_complete(Ctrl_P, FALSE);
!
! /* Lazily show the popup menu, unless we got interrupted. */
! if (!compl_interrupted)
! show_pum(save_w_wrow);
out_flush();
}
***************
*** 3484,3490 ****
}
#endif
compl_restarting = TRUE;
! if (ins_complete(Ctrl_N) == FAIL)
compl_cont_status = 0;
compl_restarting = FALSE;
}
--- 3491,3497 ----
}
#endif
compl_restarting = TRUE;
! if (ins_complete(Ctrl_N, TRUE) == FAIL)
compl_cont_status = 0;
compl_restarting = FALSE;
}
***************
*** 5017,5023 ****
* Returns OK if completion was done, FAIL if something failed (out of mem).
*/
static int
! ins_complete(int c)
{
char_u *line;
int startcol = 0; /* column where searched text
starts */
--- 5024,5030 ----
* Returns OK if completion was done, FAIL if something failed (out of mem).
*/
static int
! ins_complete(int c, int enable_pum)
{
char_u *line;
int startcol = 0; /* column where searched text
starts */
***************
*** 5610,5629 ****
}
/* Show the popup menu, unless we got interrupted. */
! if (!compl_interrupted)
{
! /* RedrawingDisabled may be set when invoked through complete(). */
! 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;
}
compl_was_interrupted = compl_interrupted;
compl_interrupted = FALSE;
--- 5617,5625 ----
}
/* 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;
***************
*** 5631,5636 ****
--- 5627,5650 ----
return OK;
}
+ 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;
+ }
+
/*
* Looks in the first "len" chars. of "src" for search-metachars.
* If dest is not NULL the chars. are copied there quoting (with
*** ../vim-7.4.1404/src/version.c 2016-02-23 19:33:57.429544837 +0100
--- src/version.c 2016-02-23 20:09:34.463069833 +0100
***************
*** 750,751 ****
--- 750,753 ----
{ /* Add new patch number below this line */
+ /**/
+ 1405,
/**/
--
Q: What do you call a fish without an eye?
A: fsh!
Q: What do you call a deer with no eyes?
A: no eye deer.
Q: What do you call a deer with no eyes and no legs?
A: still no eye deer.
/// Bram Moolenaar -- [email protected] -- 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 ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.