Store last clipboard register type

This makes `yy` -> `p` line copying work correctly, but whether external
text would be pasted as whole lines or not now depends on the last copy
operation.

The proper implementation would store the register type in the actual
Gtk clipboard, but gtk-rs is not ready for that yet.
This commit is contained in:
Greg V 2018-01-03 15:49:10 +03:00
parent 53516f0d9c
commit 87dafda473

View File

@ -5,10 +5,12 @@ endif
let g:GuiLoaded = 1
if exists('g:GuiInternalClipboard')
let s:LastRegType = 'v'
function! provider#clipboard#Call(method, args) abort
if a:method == 'get'
return [rpcrequest(1, 'Gui', 'Clipboard', 'Get', a:args[0]), 'v']
return [rpcrequest(1, 'Gui', 'Clipboard', 'Get', a:args[0]), s:LastRegType]
elseif a:method == 'set'
let s:LastRegType = a:args[1]
call rpcnotify(1, 'Gui', 'Clipboard', 'Set', a:args[2], join(a:args[0], ' '))
endif
endfunction