diff options
| author | Tommy Allen <tommy@esdf.io> | 2016-10-17 17:16:56 -0400 | 
|---|---|---|
| committer | Tommy Allen <tommy@esdf.io> | 2016-10-22 15:15:21 -0400 | 
| commit | c377c8be6185f0773163c915d3caf0862bc26f53 (patch) | |
| tree | e34ec3780ca7fe40849850d8a7c42fe71378c4f3 /test/functional/viml/completion_spec.lua | |
| parent | 31df051ed9a3f8cc9ad7a4e408e3ba03a1c5272b (diff) | |
| download | rneovim-c377c8be6185f0773163c915d3caf0862bc26f53.tar.gz rneovim-c377c8be6185f0773163c915d3caf0862bc26f53.tar.bz2 rneovim-c377c8be6185f0773163c915d3caf0862bc26f53.zip | |
vim-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.
Diffstat (limited to 'test/functional/viml/completion_spec.lua')
| -rw-r--r-- | test/functional/viml/completion_spec.lua | 56 | 
1 files changed, 56 insertions, 0 deletions
| diff --git a/test/functional/viml/completion_spec.lua b/test/functional/viml/completion_spec.lua index 0897c2d836..da3400fb27 100644 --- a/test/functional/viml/completion_spec.lua +++ b/test/functional/viml/completion_spec.lua @@ -317,6 +317,62 @@ describe('completion', function()      end)    end) +  describe('completeopt+=noinsert does not add blank undo items', function() +    before_each(function() +      source([[ +      function! TestComplete() abort +        call complete(1, ['foo', 'bar']) +        return '' +      endfunction +      ]]) +      execute('set completeopt+=noselect,noinsert') +      execute('inoremap <right> <c-r>=TestComplete()<cr>') +    end) + +    local tests = { +      ['<up>, <down>, <cr>'] = {'<down><cr>', '<up><cr>'}, +      ['<c-n>, <c-p>, <c-y>'] = {'<c-n><c-y>', '<c-p><c-y>'}, +    } + +    for name, seq in pairs(tests) do +      it('using ' .. name, function() +        feed('iaaa<esc>') +        feed('A<right>' .. seq[1] .. '<esc>') +        feed('A<right><esc>A<right><esc>') +        feed('A<cr>bbb<esc>') +        feed('A<right>' .. seq[2] .. '<esc>') +        feed('A<right><esc>A<right><esc>') +        feed('A<cr>ccc<esc>') +        feed('A<right>' .. seq[1] .. '<esc>') +        feed('A<right><esc>A<right><esc>') + +        local expected = { +          {'foo', 'bar', 'foo'}, +          {'foo', 'bar', 'ccc'}, +          {'foo', 'bar'}, +          {'foo', 'bbb'}, +          {'foo'}, +          {'aaa'}, +          {''}, +        } + +        for i = 1, #expected do +          if i > 1 then +            feed('u') +          end +          eq(expected[i], eval('getline(1, "$")')) +        end + +        for i = #expected, 1, -1 do +          if i < #expected then +            feed('<c-r>') +          end +          eq(expected[i], eval('getline(1, "$")')) +        end +      end) +    end +  end) +    describe("refresh:always", function()      before_each(function()        source([[ | 
