mirror of
https://github.com/neovim/neovim
synced 2025-07-17 01:31:48 +00:00
fix(bufupdates): send correct updates for visual paste
One step further towards stable tree-sitter. Co-authored-by: Björn Linse <bjorn.linse@gmail.com>
This commit is contained in:
@ -3444,8 +3444,9 @@ void do_put(int regname, yankreg_T *reg, int dir, long count, int flags)
|
|||||||
(int)y_size-1, lastsize, totsize,
|
(int)y_size-1, lastsize, totsize,
|
||||||
kExtmarkUndo);
|
kExtmarkUndo);
|
||||||
} else if (y_type == kMTLineWise && flags & PUT_LINE_SPLIT) {
|
} else if (y_type == kMTLineWise && flags & PUT_LINE_SPLIT) {
|
||||||
extmark_splice(curbuf, (int)new_cursor.lnum-1, col, 0, 0, 0,
|
// Account for last pasted NL + last NL
|
||||||
(int)y_size+1, 0, totsize+1, kExtmarkUndo);
|
extmark_splice(curbuf, (int)new_cursor.lnum-1, col + 1, 0, 0, 0,
|
||||||
|
(int)y_size+1, 0, totsize+2, kExtmarkUndo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -978,6 +978,22 @@ describe('lua: nvim_buf_attach on_bytes', function()
|
|||||||
}
|
}
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
it("visual paste", function()
|
||||||
|
local check_events= setup_eventcheck(verify, { "aaa {", "b", "}" })
|
||||||
|
-- Setting up
|
||||||
|
feed[[jdd]]
|
||||||
|
check_events {
|
||||||
|
{ "test1", "bytes", 1, 3, 1, 0, 6, 1, 0, 2, 0, 0, 0 };
|
||||||
|
}
|
||||||
|
|
||||||
|
-- Actually testing
|
||||||
|
feed[[v%p]]
|
||||||
|
check_events {
|
||||||
|
{ "test1", "bytes", 1, 8, 0, 4, 4, 1, 1, 3, 0, 0, 0 };
|
||||||
|
{ "test1", "bytes", 1, 8, 0, 4, 4, 0, 0, 0, 2, 0, 3 };
|
||||||
|
}
|
||||||
|
end)
|
||||||
|
|
||||||
it("nvim_buf_set_lines", function()
|
it("nvim_buf_set_lines", function()
|
||||||
local check_events = setup_eventcheck(verify, {"AAA", "BBB"})
|
local check_events = setup_eventcheck(verify, {"AAA", "BBB"})
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user