patch 9.1.1121: Enter does not insert newline with "noselect"
Problem: Enter does not insert newline with "noselect" when the pum is
visible (lifepillar)
Solution: When Enter is pressed and no complete-item is selected,
ins_compl_prep returns false, and the edit function continues
processing Enter to insert a new line. (glepnir)
fixes: #1653
closes: #16653
Signed-off-by: glepnir <glephunter@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/testdir/test_edit.vim b/src/testdir/test_edit.vim
index 1665330..9ce8bb2 100644
--- a/src/testdir/test_edit.vim
+++ b/src/testdir/test_edit.vim
@@ -198,7 +198,7 @@
endif
endfu
au InsertCharPre <buffer> :call DoIt()
- call feedkeys("A\<f5>\<c-p>u\<cr>\<c-l>\<cr>", 'tx')
+ call feedkeys("A\<f5>\<c-p>u\<C-Y>\<c-l>\<cr>", 'tx')
call assert_equal(["Jan\<c-l>",''], 1->getline('$'))
%d
call setline(1, 'J')
@@ -594,7 +594,7 @@
call assert_equal([include, 'two', ''], getline(1, '$'))
call feedkeys("2ggC\<c-x>\<tab>\<down>\<down>\<cr>\<esc>", 'tnix')
call assert_equal([include, 'three', ''], getline(1, '$'))
- call feedkeys("2ggC\<c-x>\<tab>\<down>\<down>\<down>\<cr>\<esc>", 'tnix')
+ call feedkeys("2ggC\<c-x>\<tab>\<down>\<down>\<down>\<C-y>\<esc>", 'tnix')
call assert_equal([include, '', ''], getline(1, '$'))
bw!
endfunc
@@ -622,7 +622,7 @@
%d
call setline(1, 'A')
call cursor(1, 1)
- call feedkeys("A\<c-x>\<c-k>\<down>\<down>\<down>\<cr>\<esc>", 'tnix')
+ call feedkeys("A\<c-x>\<c-k>\<down>\<down>\<down>\<C-Y>\<esc>", 'tnix')
call assert_equal(['A'], getline(1, '$'))
%d
call setline(1, 'A')
@@ -2293,4 +2293,15 @@
set smarttab&
endfunc
+func Test_edit_CAR()
+ set cot=menu,menuone,noselect
+ new
+
+ call feedkeys("Shello hero\<CR>h\<C-x>\<C-N>e\<CR>", 'tx')
+ call assert_equal(['hello hero', 'he', ''], getline(1, '$'))
+
+ bw!
+ set cot&
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/testdir/test_ins_complete.vim b/src/testdir/test_ins_complete.vim
index ac400a2..be7d802 100644
--- a/src/testdir/test_ins_complete.vim
+++ b/src/testdir/test_ins_complete.vim
@@ -2855,7 +2855,7 @@
call setline(1, ['Text', 'ToText', ''])
call cursor(3, 1)
call feedkeys("STe\<C-X>\<C-N>x\<CR>\<Esc>0", 'tx!')
- call assert_equal('Tex', getline('.'))
+ call assert_equal('Tex', getline(line('.') - 1))
" test case for nosort option
set cot=menuone,menu,noinsert,fuzzy,nosort
diff --git a/src/testdir/test_popup.vim b/src/testdir/test_popup.vim
index 7c8faa9..63f0016 100644
--- a/src/testdir/test_popup.vim
+++ b/src/testdir/test_popup.vim
@@ -987,7 +987,7 @@
call setline(1, ['Post', 'Port', 'Po'])
let expected=['Post', 'Port', 'Port']
call cursor(3,2)
- call feedkeys("A\<C-X>". repeat("\<C-P>", 3). "rt\<cr>", 'tx')
+ call feedkeys("A\<C-X>". repeat("\<C-P>", 3). "rt\<C-Y>", 'tx')
call assert_equal(expected, getline(1,'$'))
bwipe!
endfunc
@@ -997,7 +997,7 @@
call setline(1, ['Post', 'Port', 'Po'])
let expected=['Post', 'Port', 'Port']
call cursor(3,2)
- call feedkeys("A\<C-P>\<C-N>rt\<cr>", 'tx')
+ call feedkeys("A\<C-P>\<C-N>rt\<C-Y>", 'tx')
call assert_equal(expected, getline(1,'$'))
bwipe!
endfunc