diff options
author | Shougo Matsushita <Shougo.Matsu@gmail.com> | 2016-03-31 20:52:56 +0900 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2016-04-09 13:36:37 -0400 |
commit | d227c843bf11f4dca8c9eb3a23f529b2977fcd21 (patch) | |
tree | ed92cb26d284ffa9f150e93f6cf278b0dbdd16da | |
parent | 5330aa104bc9d978cb55a4f689e9b90b50ebb687 (diff) | |
download | rneovim-d227c843bf11f4dca8c9eb3a23f529b2977fcd21.tar.gz rneovim-d227c843bf11f4dca8c9eb3a23f529b2977fcd21.tar.bz2 rneovim-d227c843bf11f4dca8c9eb3a23f529b2977fcd21.zip |
complete: noinsert/noselect should not set 'modified'. #4509
-rw-r--r-- | src/nvim/edit.c | 13 | ||||
-rw-r--r-- | test/functional/viml/completion_spec.lua | 12 |
2 files changed, 19 insertions, 6 deletions
diff --git a/src/nvim/edit.c b/src/nvim/edit.c index 1c33c4d549..614a5d43be 100644 --- a/src/nvim/edit.c +++ b/src/nvim/edit.c @@ -2358,13 +2358,13 @@ void set_completion(colnr_T startcol, list_T *list) int save_w_wrow = curwin->w_wrow; compl_curr_match = compl_first_match; - if (compl_no_insert) { + if (compl_no_insert || compl_no_select) { ins_complete(K_DOWN, false); - } else { - ins_complete(Ctrl_N, false); if (compl_no_select) { - ins_complete(Ctrl_P, false); + ins_complete(K_UP, false); } + } else { + ins_complete(Ctrl_N, false); } // Lazily show the popup menu, unless we got interrupted. @@ -4239,9 +4239,10 @@ void ins_compl_check_keys(int frequency) static int ins_compl_key2dir(int c) { if (c == Ctrl_P || c == Ctrl_L - || (pum_visible() && (c == K_PAGEUP || c == K_KPAGEUP - || c == K_S_UP || c == K_UP))) + || c == K_PAGEUP || c == K_KPAGEUP + || c == K_S_UP || c == K_UP) { return BACKWARD; + } return FORWARD; } diff --git a/test/functional/viml/completion_spec.lua b/test/functional/viml/completion_spec.lua index 20eee24524..01b2bad059 100644 --- a/test/functional/viml/completion_spec.lua +++ b/test/functional/viml/completion_spec.lua @@ -100,6 +100,18 @@ describe('completion', function() feed('o<C-r>=TestComplete()<CR><ESC>') eq('', eval('getline(3)')) end) + it('does not change modified state if noinsert', function() + execute('set completeopt+=menuone,noinsert') + execute('setlocal nomodified') + feed('i<C-r>=TestComplete()<CR><ESC>') + eq(0, eval('&l:modified')) + end) + it('does not change modified state if noselect', function() + execute('set completeopt+=menuone,noselect') + execute('setlocal nomodified') + feed('i<C-r>=TestComplete()<CR><ESC>') + eq(0, eval('&l:modified')) + end) end) describe("refresh:always", function() |