}
#endif
- if ((State & MODE_INSERT) && in_curline && ins_compl_active())
+ if ((State & MODE_INSERT) && in_curline && ins_compl_win_active(wp))
area_highlighting = TRUE;
#ifdef FEAT_SYN_HL
#endif
// Check if ComplMatchIns highlight is needed.
- if ((State & MODE_INSERT) && in_curline && ins_compl_active())
+ if ((State & MODE_INSERT) && in_curline
+ && ins_compl_win_active(wp))
{
int ins_match_attr =
ins_compl_col_range_attr((int)(ptr - line));
return compl_started;
}
+/*
+ * Return True when wp is the actual completion window
+ */
+ int
+ins_compl_win_active(win_T *wp UNUSED)
+{
+ return ins_compl_active()
+#if defined(FEAT_QUICKFIX)
+ && (!wp->w_p_pvw
+# ifdef FEAT_PROP_POPUP
+ && !(wp->w_popup_flags & POPF_INFO)
+# endif
+ )
+#endif
+ ;
+}
+
/*
* Selected one of the matches. When FALSE the match was edited or using the
* longest common string.
{
int resized = FALSE;
int context = pum_height / 2;
- int scroll_offset = pum_selected - pum_height;
+ int scroll_offset;
#ifdef FEAT_QUICKFIX
int prev_selected = pum_selected;
unsigned cur_cot_flags = get_cot_flags();
#endif
pum_selected = n;
+ scroll_offset = pum_selected - pum_height;
if (pum_selected >= 0 && pum_selected < pum_size)
{
// scroll up; when we did a jump it's probably a PageDown then
// scroll a whole page
if (pum_first < scroll_offset + 3)
- pum_first = MAX(pum_first, scroll_offset + 1);
+ pum_first = MAX(pum_first + pum_height - 2, scroll_offset + 1);
else
pum_first = scroll_offset + 1;
}
char_u *find_word_end(char_u *ptr);
void ins_compl_clear(void);
int ins_compl_active(void);
+int ins_compl_win_active(win_T *wp);
int ins_compl_used_match(void);
void ins_compl_init_get_longest(void);
int ins_compl_interrupted(void);
--- /dev/null
+|i+0&#ffffff0|n|f|o| @70
+|~+0#4040ff13&| @73
+|~| @73
+|[+1#0000000&|S|c|r|a|t|c|h|]| |[|P|r|e|v|i|e|w|]| @37|1|,|1| @11|A|l@1
+|f+0&&|o@1> @71
+|f+0#0000001#e0e0e08|o@1| @11| +0#4040ff13#ffffff0@59
+|b+0#0000001#ffd7ff255|a|r| @11| +0#4040ff13#ffffff0@59
+|你*0#0000001#ffd7ff255|好| +&@10| +0#4040ff13#ffffff0@59
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|[+3#0000000&|N|o| |N|a|m|e|]| |[|+|]| @43|1|,|1| @11|A|l@1
+|-+2&&@1| |O|m|n|i| |c|o|m|p|l|e|t|i|o|n| |(|^|O|^|N|^|P|)| |m+0#00e0003&|a|t|c|h| |1| |o|f| |3| +0#0000000&@34
func Test_pum_matchins_highlight()
CheckScreendump
let lines =<< trim END
+ let g:change = 0
func Omni_test(findstart, base)
if a:findstart
return col(".")
endif
- return [#{word: "foo"}, #{word: "bar"}, #{word: "你好"}]
+ if g:change == 0
+ return [#{word: "foo"}, #{word: "bar"}, #{word: "你好"}]
+ endif
+ return [#{word: "foo", info: "info"}, #{word: "bar"}, #{word: "你好"}]
endfunc
set omnifunc=Omni_test
hi ComplMatchIns ctermfg=red
call VerifyScreenDump(buf, 'Test_pum_matchins_10', {})
call term_sendkeys(buf, "\<Esc>")
+ call term_sendkeys(buf, ":let g:change=1\<CR>S\<C-X>\<C-O>")
+ call VerifyScreenDump(buf, 'Test_pum_matchins_11', {})
+ call term_sendkeys(buf, "\<Esc>")
+
call StopVimInTerminal(buf)
endfunc
call StopVimInTerminal(buf)
endfunc
+" this used to crash
+func Test_popup_completion_many_ctrlp()
+ new
+ let candidates=repeat(['a0'], 99)
+ call setline(1, candidates)
+ exe ":norm! VGg\<C-A>"
+ norm! G
+ call feedkeys("o" .. repeat("\<c-p>", 100), 'tx')
+ bw!
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 956,
/**/
955,
/**/