Mercurial > vim
comparison src/testdir/test_popup.vim @ 10289:af5b6efad23f v8.0.0041
commit https://github.com/vim/vim/commit/869e35270ecffd9024958880cb03f6f0bb01ea93
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Oct 16 15:35:47 2016 +0200
patch 8.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.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 16 Oct 2016 15:45:04 +0200 |
parents | 154d5a2e7395 |
children | d9bd03a0d70f |
comparison
equal
deleted
inserted
replaced
10288:aef7866360ed | 10289:af5b6efad23f |
---|---|
376 call complete_add('four6') | 376 call complete_add('four6') |
377 return [] | 377 return [] |
378 endif | 378 endif |
379 endfunc | 379 endfunc |
380 | 380 |
381 :"Test that 'completefunc' works when it's OK. | 381 " Test that 'completefunc' works when it's OK. |
382 func Test_omnifunc_with_check() | 382 func Test_omnifunc_with_check() |
383 new | 383 new |
384 setlocal omnifunc=DummyCompleteFour | 384 setlocal omnifunc=DummyCompleteFour |
385 call setline(1, 'four') | 385 call setline(1, 'four') |
386 /^four | 386 /^four |
398 call assert_equal('four5', getline(1)) | 398 call assert_equal('four5', getline(1)) |
399 | 399 |
400 q! | 400 q! |
401 endfunc | 401 endfunc |
402 | 402 |
403 function UndoComplete() | |
404 call complete(1, ['January', 'February', 'March', | |
405 \ 'April', 'May', 'June', 'July', 'August', 'September', | |
406 \ 'October', 'November', 'December']) | |
407 return '' | |
408 endfunc | |
409 | |
410 " Test that no undo item is created when no completion is inserted | |
411 func Test_complete_no_undo() | |
412 set completeopt=menu,preview,noinsert,noselect | |
413 inoremap <Right> <C-R>=UndoComplete()<CR> | |
414 new | |
415 call feedkeys("ixxx\<CR>\<CR>yyy\<Esc>k", 'xt') | |
416 call feedkeys("iaaa\<Esc>0", 'xt') | |
417 call assert_equal('aaa', getline(2)) | |
418 call feedkeys("i\<Right>\<Esc>", 'xt') | |
419 call assert_equal('aaa', getline(2)) | |
420 call feedkeys("u", 'xt') | |
421 call assert_equal('', getline(2)) | |
422 | |
423 iunmap <Right> | |
424 set completeopt& | |
425 q! | |
426 endfunc | |
427 | |
428 | |
403 " vim: shiftwidth=2 sts=2 expandtab | 429 " vim: shiftwidth=2 sts=2 expandtab |