mirror of
https://github.com/neovim/neovim.git
synced 2025-09-07 03:48:18 +00:00
clipboard: setreg("*") with clipboard=unnamed #9954
Helped-by: Björn Linse <bjorn.linse@gmail.com> fix #5646
This commit is contained in:
@@ -5616,6 +5616,9 @@ static yankreg_T *adjust_clipboard_name(int *name, bool quiet, bool writing)
|
|||||||
|
|
||||||
if (explicit_cb_reg) {
|
if (explicit_cb_reg) {
|
||||||
target = &y_regs[*name == '*' ? STAR_REGISTER : PLUS_REGISTER];
|
target = &y_regs[*name == '*' ? STAR_REGISTER : PLUS_REGISTER];
|
||||||
|
if (writing && (cb_flags & (*name == '*' ? CB_UNNAMED : CB_UNNAMEDPLUS))) {
|
||||||
|
clipboard_needs_update = false;
|
||||||
|
}
|
||||||
goto end;
|
goto end;
|
||||||
} else { // unnamed register: "implicit" clipboard
|
} else { // unnamed register: "implicit" clipboard
|
||||||
if (writing && clipboard_delay_update) {
|
if (writing && clipboard_delay_update) {
|
||||||
|
@@ -236,7 +236,7 @@ describe('clipboard', function()
|
|||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
describe('clipboard', function()
|
describe('clipboard (with fake clipboard.vim)', function()
|
||||||
local function reset(...)
|
local function reset(...)
|
||||||
clear('--cmd', 'let &rtp = "test/functional/fixtures,".&rtp', ...)
|
clear('--cmd', 'let &rtp = "test/functional/fixtures,".&rtp', ...)
|
||||||
end
|
end
|
||||||
@@ -664,4 +664,20 @@ describe('clipboard', function()
|
|||||||
the a sourcetarget]])
|
the a sourcetarget]])
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
it('setreg("*") with clipboard=unnamed #5646', function()
|
||||||
|
source([=[
|
||||||
|
function! Paste_without_yank(direction) range
|
||||||
|
let [reg_save,regtype_save] = [getreg('*'), getregtype('*')]
|
||||||
|
normal! gvp
|
||||||
|
call setreg('*', reg_save, regtype_save)
|
||||||
|
endfunction
|
||||||
|
xnoremap p :call Paste_without_yank('p')<CR>
|
||||||
|
set clipboard=unnamed
|
||||||
|
]=])
|
||||||
|
insert('some words')
|
||||||
|
feed('gg0yiw')
|
||||||
|
feed('wviwp')
|
||||||
|
expect('some some')
|
||||||
|
eq('some', eval('getreg("*")'))
|
||||||
|
end)
|
||||||
end)
|
end)
|
||||||
|
Reference in New Issue
Block a user