From 172cf079c7a7f20e557e611d3160962794644a4f Mon Sep 17 00:00:00 2001 From: Shougo Matsushita Date: Sat, 23 Jul 2016 11:23:00 +0900 Subject: vim-patch:7.4.2013, vim-patch:7.4.2014 vim-patch:7.4.2013 Problem: Using "noinsert" in 'completeopt' breaks redo. Solution: Set compl_curr_match. (Shougo, closes vim/vim#874) https://github.com/vim/vim/commit/67081e50616ae9546621072c5eaaa59bd0a4bed7 vim-patch:7.4.2014 Problem: Using "noinsert" in 'completeopt' does not insert match. Solution: Set compl_enter_selects. (Shougo, closes #875) https://github.com/vim/vim/commit/32b808a4bdf35b0dea63c735702a591e5869fecd --- src/nvim/edit.c | 2 ++ src/nvim/testdir/test_alot.vim | 1 + src/nvim/testdir/test_popup.vim | 30 ++++++++++++++++++++++++++++++ src/nvim/version.c | 4 ++-- 4 files changed, 35 insertions(+), 2 deletions(-) create mode 100644 src/nvim/testdir/test_popup.vim (limited to 'src') diff --git a/src/nvim/edit.c b/src/nvim/edit.c index 03ef41f849..98ec9ae280 100644 --- a/src/nvim/edit.c +++ b/src/nvim/edit.c @@ -2385,6 +2385,7 @@ void set_completion(colnr_T startcol, list_T *list) } else { ins_complete(Ctrl_N, false); } + compl_enter_selects = compl_no_insert; // Lazily show the popup menu, unless we got interrupted. if (!compl_interrupted) { @@ -3989,6 +3990,7 @@ static void ins_compl_insert(void) dict_add_nr_str(dict, "info", 0L, EMPTY_IF_NULL(compl_shown_match->cp_text[CPT_INFO])); set_vim_var_dict(VV_COMPLETED_ITEM, dict); + compl_curr_match = compl_shown_match; } /* diff --git a/src/nvim/testdir/test_alot.vim b/src/nvim/testdir/test_alot.vim index ad9b2cce8b..14ea73818a 100644 --- a/src/nvim/testdir/test_alot.vim +++ b/src/nvim/testdir/test_alot.vim @@ -4,4 +4,5 @@ source test_assign.vim source test_cursor_func.vim source test_menu.vim +source test_popup.vim source test_unlet.vim diff --git a/src/nvim/testdir/test_popup.vim b/src/nvim/testdir/test_popup.vim new file mode 100644 index 0000000000..78fc81e3d2 --- /dev/null +++ b/src/nvim/testdir/test_popup.vim @@ -0,0 +1,30 @@ +" Test for completion menu + +function! ComplTest() abort + call complete(1, ['source', 'soundfold']) + return '' +endfunction + +function! Test() abort + call complete(1, ['source', 'soundfold']) + return '' +endfunction + +func Test_noinsert_complete() + new + set completeopt+=noinsert + inoremap =ComplTest() + call feedkeys("i\soun\\\.", 'tx') + call assert_equal('soundfold', getline(1)) + call assert_equal('soundfold', getline(2)) + bwipe! + + new + inoremap =Test() + call feedkeys("i\\\", 'tx') + call assert_equal('source', getline(1)) + bwipe! + + set completeopt-=noinsert + iunmap +endfunc diff --git a/src/nvim/version.c b/src/nvim/version.c index d0af76ac8b..705bc808d7 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -261,8 +261,8 @@ static int included_patches[] = { // 2017, // 2016 NA // 2015, - // 2014, - // 2013, + 2014, + 2013, // 2012, // 2011, // 2010, -- cgit