mirror of
https://github.com/neovim/neovim.git
synced 2025-10-05 17:36:29 +00:00
Merge pull request #13899 from chentau/set_text_fix
correctly mark changed regions for set_text
This commit is contained in:
@@ -722,7 +722,8 @@ void nvim_buf_set_text(uint64_t channel_id, Buffer buffer,
|
|||||||
kExtmarkUndo);
|
kExtmarkUndo);
|
||||||
|
|
||||||
|
|
||||||
changed_lines((linenr_T)start_row, 0, (linenr_T)end_row, (long)extra, true);
|
changed_lines((linenr_T)start_row, 0, (linenr_T)end_row + 1,
|
||||||
|
(long)extra, true);
|
||||||
|
|
||||||
// adjust cursor like an extmark ( i e it was inside last_part_len)
|
// adjust cursor like an extmark ( i e it was inside last_part_len)
|
||||||
if (curwin->w_cursor.lnum == end_row && curwin->w_cursor.col > end_col) {
|
if (curwin->w_cursor.lnum == end_row && curwin->w_cursor.col > end_col) {
|
||||||
|
@@ -513,6 +513,28 @@ describe('api/buf', function()
|
|||||||
eq({0, 8}, curbufmeths.get_extmark_by_id(ns, id2, {}))
|
eq({0, 8}, curbufmeths.get_extmark_by_id(ns, id2, {}))
|
||||||
eq({0, 8}, curbufmeths.get_extmark_by_id(ns, id3, {}))
|
eq({0, 8}, curbufmeths.get_extmark_by_id(ns, id3, {}))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
it("correctly marks changed region for redraw #13890", function()
|
||||||
|
local screen = Screen.new(20, 5)
|
||||||
|
screen:attach()
|
||||||
|
|
||||||
|
insert([[
|
||||||
|
AAA
|
||||||
|
BBB
|
||||||
|
]])
|
||||||
|
|
||||||
|
curbufmeths.set_text(0, 0, 1, 3, {'XXX', 'YYY'})
|
||||||
|
|
||||||
|
screen:expect([[
|
||||||
|
XXX |
|
||||||
|
YYY |
|
||||||
|
^ |
|
||||||
|
~ |
|
||||||
|
|
|
||||||
|
|
||||||
|
]])
|
||||||
|
|
||||||
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
describe('nvim_buf_get_offset', function()
|
describe('nvim_buf_get_offset', function()
|
||||||
|
Reference in New Issue
Block a user