clipboard: reallow :put

This commit is contained in:
Björn Linse 2015-03-18 23:43:49 +01:00
parent 5600b80c1f
commit 34dba3d7cd
3 changed files with 21 additions and 10 deletions

BIN
src/nvim/.screen.c.swn Normal file

Binary file not shown.

View File

@ -1699,16 +1699,11 @@ static char_u * do_one_cmd(char_u **cmdlinep,
} }
/* accept numbered register only when no count allowed (:put) */ /* accept numbered register only when no count allowed (:put) */
if ( (ea.argt & REGSTR) if ((ea.argt & REGSTR)
&& *ea.arg != NUL && *ea.arg != NUL
/* Do not allow register = for user commands */ /* Do not allow register = for user commands */
&& (!IS_USER_CMDIDX(ea.cmdidx) || *ea.arg != '=') && (!IS_USER_CMDIDX(ea.cmdidx) || *ea.arg != '=')
&& !((ea.argt & COUNT) && VIM_ISDIGIT(*ea.arg))) { && !((ea.argt & COUNT) && VIM_ISDIGIT(*ea.arg))) {
/* check these explicitly for a more specific error message */
if (*ea.arg == '*' || *ea.arg == '+') {
errormsg = (char_u *)_(e_invalidreg);
goto doend;
}
if (valid_yank_reg(*ea.arg, (ea.cmdidx != CMD_put if (valid_yank_reg(*ea.arg, (ea.cmdidx != CMD_put
&& !IS_USER_CMDIDX(ea.cmdidx)))) { && !IS_USER_CMDIDX(ea.cmdidx)))) {
ea.regname = *ea.arg++; ea.regname = *ea.arg++;

View File

@ -160,6 +160,22 @@ describe('clipboard usage', function()
linewise stuff]]) linewise stuff]])
end) end)
it('supports :put', function()
insert("a line")
execute("let g:test_clip['*'] = ['some text']")
execute("let g:test_clip['+'] = ['more', 'text', '']")
execute(":put *")
expect([[
a line
some text]])
execute(":put +")
expect([[
a line
some text
more
text]])
end)
it('supports "+ and "* in registers', function() it('supports "+ and "* in registers', function()
local screen = Screen.new(60, 10) local screen = Screen.new(60, 10)
screen:attach() screen:attach()