vim-patch:8.0.0247 (#7232)

Problem:    Under some circumstances, one needs to type Ctrl-N or Ctrl-P twice
            to have a menu entry selected. (Lifepillar)
Solution:   call ins_compl_free(). (Christian Brabandt, closes vim/vim#1411)

aed6d0b81a
This commit is contained in:
KunMing Xie
2017-09-03 16:58:32 +08:00
committed by Justin M. Keyes
parent 7bfa4406c1
commit 11429f9429
3 changed files with 35 additions and 5 deletions

View File

@@ -2406,6 +2406,7 @@ void set_completion(colnr_T startcol, list_T *list)
ins_compl_prep(' '); ins_compl_prep(' ');
} }
ins_compl_clear(); ins_compl_clear();
ins_compl_free();
compl_direction = FORWARD; compl_direction = FORWARD;
if (startcol > curwin->w_cursor.col) if (startcol > curwin->w_cursor.col)

View File

@@ -541,4 +541,33 @@ func Test_completion_comment_formatting()
bwipe! bwipe!
endfunc endfunc
function! DummyCompleteSix()
call complete(1, ['Hello', 'World'])
return ''
endfunction
" complete() correctly clears the list of autocomplete candidates
func Test_completion_clear_candidate_list()
new
%d
" select first entry from the completion popup
call feedkeys("a xxx\<C-N>\<C-R>=DummyCompleteSix()\<CR>", "tx")
call assert_equal('Hello', getline(1))
%d
" select second entry from the completion popup
call feedkeys("a xxx\<C-N>\<C-R>=DummyCompleteSix()\<CR>\<C-N>", "tx")
call assert_equal('World', getline(1))
%d
" select original text
call feedkeys("a xxx\<C-N>\<C-R>=DummyCompleteSix()\<CR>\<C-N>\<C-N>", "tx")
call assert_equal(' xxx', getline(1))
%d
" back at first entry from completion list
call feedkeys("a xxx\<C-N>\<C-R>=DummyCompleteSix()\<CR>\<C-N>\<C-N>\<C-N>", "tx")
call assert_equal('Hello', getline(1))
bw!
endfunc
" vim: shiftwidth=2 sts=2 expandtab " vim: shiftwidth=2 sts=2 expandtab

View File

@@ -705,7 +705,7 @@ static const int included_patches[] = {
250, 250,
// 249 NA // 249 NA
// 248, // 248,
// 247, 247,
// 246 NA // 246 NA
// 245, // 245,
// 244, // 244,