summaryrefslogtreecommitdiff
path: root/src/testdir/test_popup.vim
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2016-10-16 15:35:47 +0200
committerBram Moolenaar <Bram@vim.org>2016-10-16 15:35:47 +0200
commit869e35270ecffd9024958880cb03f6f0bb01ea93 (patch)
treeda022669c9ecf5145ffce0963fa53984fda22c17 /src/testdir/test_popup.vim
parent8507747600bddfd6a68aed057840856bf5548e61 (diff)
downloadvim-git-869e35270ecffd9024958880cb03f6f0bb01ea93.tar.gz
patch 8.0.0041v8.0.0041
Problem: When using Insert mode completion but not actually inserting anything an undo item is still created. (Tommy Allen) Solution: Do not call stop_arrow() when not inserting anything.
Diffstat (limited to 'src/testdir/test_popup.vim')
-rw-r--r--src/testdir/test_popup.vim28
1 files changed, 27 insertions, 1 deletions
diff --git a/src/testdir/test_popup.vim b/src/testdir/test_popup.vim
index 7cb0e10aa..38459b323 100644
--- a/src/testdir/test_popup.vim
+++ b/src/testdir/test_popup.vim
@@ -378,7 +378,7 @@ func DummyCompleteFour(findstart, base)
endif
endfunc
-:"Test that 'completefunc' works when it's OK.
+" Test that 'completefunc' works when it's OK.
func Test_omnifunc_with_check()
new
setlocal omnifunc=DummyCompleteFour
@@ -400,4 +400,30 @@ func Test_omnifunc_with_check()
q!
endfunc
+function UndoComplete()
+ call complete(1, ['January', 'February', 'March',
+ \ 'April', 'May', 'June', 'July', 'August', 'September',
+ \ 'October', 'November', 'December'])
+ return ''
+endfunc
+
+" Test that no undo item is created when no completion is inserted
+func Test_complete_no_undo()
+ set completeopt=menu,preview,noinsert,noselect
+ inoremap <Right> <C-R>=UndoComplete()<CR>
+ new
+ call feedkeys("ixxx\<CR>\<CR>yyy\<Esc>k", 'xt')
+ call feedkeys("iaaa\<Esc>0", 'xt')
+ call assert_equal('aaa', getline(2))
+ call feedkeys("i\<Right>\<Esc>", 'xt')
+ call assert_equal('aaa', getline(2))
+ call feedkeys("u", 'xt')
+ call assert_equal('', getline(2))
+
+ iunmap <Right>
+ set completeopt&
+ q!
+endfunc
+
+
" vim: shiftwidth=2 sts=2 expandtab