diff options
author | Björn Linse <bjorn.linse@gmail.com> | 2015-08-05 15:57:34 +0200 |
---|---|---|
committer | Björn Linse <bjorn.linse@gmail.com> | 2015-08-07 13:06:13 +0200 |
commit | d4ebbaa91aea81a9942f44afda628fbe21000897 (patch) | |
tree | 44fccceb395cf04d4a6f4e1f4c71b0be7b932425 /test | |
parent | 162361abac6305e5f2bbab03877b0a836a28e60a (diff) | |
download | rneovim-d4ebbaa91aea81a9942f44afda628fbe21000897.tar.gz rneovim-d4ebbaa91aea81a9942f44afda628fbe21000897.tar.bz2 rneovim-d4ebbaa91aea81a9942f44afda628fbe21000897.zip |
clipboard: support clipboard=unnamedplus,unnamed
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/clipboard/clipboard_provider_spec.lua | 49 | ||||
-rw-r--r-- | test/functional/fixtures/autoload/provider/clipboard.vim | 12 |
2 files changed, 57 insertions, 4 deletions
diff --git a/test/functional/clipboard/clipboard_provider_spec.lua b/test/functional/clipboard/clipboard_provider_spec.lua index f6d6188d82..30903e8b57 100644 --- a/test/functional/clipboard/clipboard_provider_spec.lua +++ b/test/functional/clipboard/clipboard_provider_spec.lua @@ -232,12 +232,15 @@ describe('clipboard usage', function() expect('words') eq({{'words'}, 'v'}, eval("g:test_clip['*']")) + -- "+ shouldn't have changed + eq({''}, eval("g:test_clip['+']")) + execute("let g:test_clip['*'] = ['linewise stuff','']") feed('p') expect([[ words linewise stuff]]) - end) + end) it('does not clobber "0 when pasting', function() insert('a line') @@ -284,6 +287,50 @@ describe('clipboard usage', function() end) + describe('with clipboard=unnamedplus', function() + before_each(function() + execute('set clipboard=unnamedplus') + end) + + it('links the "+ and unnamed registers', function() + insert("one two") + feed('^"+dwdw"+P') + expect('two') + eq({{'two'}, 'v'}, eval("g:test_clip['+']")) + + -- "* shouldn't have changed + eq({''}, eval("g:test_clip['*']")) + + execute("let g:test_clip['+'] = ['three']") + feed('p') + expect('twothree') + end) + + it('and unnamed, yanks to both', function() + execute('set clipboard=unnamedplus,unnamed') + insert([[ + really unnamed + text]]) + feed('ggdd"*p"+p') + expect([[ + text + really unnamed + really unnamed]]) + eq({{'really unnamed', ''}, 'V'}, eval("g:test_clip['+']")) + eq({{'really unnamed', ''}, 'V'}, eval("g:test_clip['*']")) + + -- unnamedplus takes predecence when pasting + execute("let g:test_clip['+'] = ['the plus','']") + execute("let g:test_clip['*'] = ['the star','']") + feed("p") + expect([[ + text + really unnamed + really unnamed + the plus]]) + end) + end) + it('supports :put', function() insert("a line") execute("let g:test_clip['*'] = ['some text']") diff --git a/test/functional/fixtures/autoload/provider/clipboard.vim b/test/functional/fixtures/autoload/provider/clipboard.vim index a28484169a..0935ea45ff 100644 --- a/test/functional/fixtures/autoload/provider/clipboard.vim +++ b/test/functional/fixtures/autoload/provider/clipboard.vim @@ -9,16 +9,22 @@ function! s:methods.get(reg) if g:cliperror return 0 end + let reg = a:reg == '"' ? '+' : a:reg if g:cliplossy " behave like pure text clipboard - return g:test_clip[a:reg][0] + return g:test_clip[reg][0] else - "behave like VIMENC clipboard - return g:test_clip[a:reg] + " behave like VIMENC clipboard + return g:test_clip[reg] end endfunction function! s:methods.set(lines, regtype, reg) + if a:reg == '"' + call s:methods.set(a:lines,a:regtype,'+') + call s:methods.set(a:lines,a:regtype,'*') + return 0 + end let g:test_clip[a:reg] = [a:lines, a:regtype] endfunction |