patch 8.0.1482: using feedkeys() does not work to test completion
Problem: Using feedkeys() does not work to test Insert mode completion.
(Lifepillar)
Solution: Do not check for typed keys when executing :normal or feedkeys().
Fix thesaurus completion not working when 'complete' is empty.
diff --git a/src/testdir/test_edit.vim b/src/testdir/test_edit.vim
index f857516..7278bcd 100644
--- a/src/testdir/test_edit.vim
+++ b/src/testdir/test_edit.vim
@@ -631,11 +631,11 @@
call feedkeys("cct\<c-x>\<c-l>\<c-n>\<esc>", 'tnix')
call assert_equal(['one', 'two', 'three', 't', '', '', ''], getline(1, '$'))
call feedkeys("cct\<c-x>\<c-l>\<c-n>\<c-n>\<esc>", 'tnix')
- call assert_equal(['one', 'two', 'three', 't', '', '', ''], getline(1, '$'))
- call feedkeys("cct\<c-x>\<c-l>\<c-n>\<c-n>\<c-n>\<esc>", 'tnix')
call assert_equal(['one', 'two', 'three', 'two', '', '', ''], getline(1, '$'))
- call feedkeys("cct\<c-x>\<c-l>\<c-n>\<c-n>\<c-n>\<c-n>\<esc>", 'tnix')
+ call feedkeys("cct\<c-x>\<c-l>\<c-n>\<c-n>\<c-n>\<esc>", 'tnix')
call assert_equal(['one', 'two', 'three', 'three', '', '', ''], getline(1, '$'))
+ call feedkeys("cct\<c-x>\<c-l>\<c-n>\<c-n>\<c-n>\<c-n>\<esc>", 'tnix')
+ call assert_equal(['one', 'two', 'three', 't', '', '', ''], getline(1, '$'))
call feedkeys("cct\<c-x>\<c-l>\<c-p>\<esc>", 'tnix')
call assert_equal(['one', 'two', 'three', 'two', '', '', ''], getline(1, '$'))
call feedkeys("cct\<c-x>\<c-l>\<c-p>\<c-p>\<esc>", 'tnix')
@@ -1357,7 +1357,6 @@
let save_columns = &columns
" Need at least about 1100 columns to reproduce the problem.
set columns=2000
- call assert_equal(2000, &columns)
set noswapfile
let longfilename = longdirname . '/' . repeat('a', 255)
diff --git a/src/testdir/test_ins_complete.vim b/src/testdir/test_ins_complete.vim
index e57782f..652b1d9 100644
--- a/src/testdir/test_ins_complete.vim
+++ b/src/testdir/test_ins_complete.vim
@@ -116,3 +116,14 @@
delfunc Omni
set omnifunc=
endfunc
+
+" Check that when using feedkeys() typeahead does not interrupt searching for
+" completions.
+func Test_compl_feedkeys()
+ new
+ set completeopt=menuone,noselect
+ call feedkeys("ajump ju\<C-X>\<C-N>\<C-P>\<ESC>", "tx")
+ call assert_equal("jump jump", getline(1))
+ bwipe!
+ set completeopt&
+endfunc
diff --git a/src/testdir/test_popup.vim b/src/testdir/test_popup.vim
index 6250c1b..d121aff 100644
--- a/src/testdir/test_popup.vim
+++ b/src/testdir/test_popup.vim
@@ -693,7 +693,7 @@
norm! gt
call assert_equal(0, &previewwindow)
norm! gT
- call assert_equal(12, tabpagenr('$'))
+ call assert_equal(10, tabpagenr('$'))
tabonly
pclose
augroup MyBufAdd