From edb13791bd6eda43ab3816c7697530b378680e61 Mon Sep 17 00:00:00 2001 From: Björn Linse Date: Sat, 11 Apr 2015 17:49:47 +0200 Subject: clipboard: simplify handling of of put in visual mode. When clipboard=unnamed and put over visual selection, reduces number of provider calls from 6 to 2. Also add test. --- test/functional/clipboard/clipboard_provider_spec.lua | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'test') diff --git a/test/functional/clipboard/clipboard_provider_spec.lua b/test/functional/clipboard/clipboard_provider_spec.lua index c5d8f57008..52fdfaa8f4 100644 --- a/test/functional/clipboard/clipboard_provider_spec.lua +++ b/test/functional/clipboard/clipboard_provider_spec.lua @@ -73,6 +73,12 @@ local function basic_register_test(noblock) stuf, stuff and some more me tsome textsome some text, stuff and some more]]) end + + -- pasting in visual does unnamed delete of visual selection + feed('ggdG') + insert("one and two and three") + feed('"ayiwbbviw"ap^viwp$viw"-p') + expect("two and three and one") end describe('the unnamed register', function() @@ -241,6 +247,14 @@ describe('clipboard usage', function() eq('\02210', eval('getregtype()')) end) + it('yanks visual selection when pasting', function() + insert("indeed visual") + execute("let g:test_clip['*'] = [['clipboard'], 'c']") + feed("viwp") + eq({{'visual'}, 'v'}, eval("g:test_clip['*']")) + expect("indeed clipboard") + end) + end) it('supports :put', function() -- cgit From 26fedb133d817274a9f4bf54f97d3e5adfba67b4 Mon Sep 17 00:00:00 2001 From: Björn Linse Date: Sun, 12 Apr 2015 22:13:45 +0200 Subject: clipboard: cleanup `valid_yank_reg` and use it for `:redir` This fixes missing clipboard support for `:redir` Helped-By: Michael Reed Helped-By: Scott Prager --- .../clipboard/clipboard_provider_spec.lua | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'test') diff --git a/test/functional/clipboard/clipboard_provider_spec.lua b/test/functional/clipboard/clipboard_provider_spec.lua index 52fdfaa8f4..716bd88242 100644 --- a/test/functional/clipboard/clipboard_provider_spec.lua +++ b/test/functional/clipboard/clipboard_provider_spec.lua @@ -305,4 +305,28 @@ describe('clipboard usage', function() feed(':*') expect('t/u/t/') end) + + it('supports :redir @*>', function() + execute("let g:test_clip['*'] = ['stuff']") + execute('redir @*>') + -- it is made empty + eq({{''}, 'v'}, eval("g:test_clip['*']")) + execute('let g:test = doesnotexist') + feed('') + eq({{ + '', + '', + 'E121: Undefined variable: doesnotexist', + 'E15: Invalid expression: doesnotexist', + }, 'v'}, eval("g:test_clip['*']")) + execute(':echo "Howdy!"') + eq({{ + '', + '', + 'E121: Undefined variable: doesnotexist', + 'E15: Invalid expression: doesnotexist', + '', + 'Howdy!', + }, 'v'}, eval("g:test_clip['*']")) + end) end) -- cgit