mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
Merge pull request #15946 from bfredl/issue-12861
fix(buffer_updates): make lockmarks not affect extmarks and buffer updates
This commit is contained in:
commit
2d206d5ab2
@ -1036,9 +1036,10 @@ static void mark_adjust_internal(linenr_T line1, linenr_T line2, long amount, lo
|
||||
}
|
||||
|
||||
sign_mark_adjust(line1, line2, amount, amount_after);
|
||||
if (op != kExtmarkNOOP) {
|
||||
extmark_adjust(curbuf, line1, line2, amount, amount_after, op);
|
||||
}
|
||||
}
|
||||
|
||||
if (op != kExtmarkNOOP) {
|
||||
extmark_adjust(curbuf, line1, line2, amount, amount_after, op);
|
||||
}
|
||||
|
||||
// previous context mark
|
||||
|
@ -1088,6 +1088,48 @@ describe('lua: nvim_buf_attach on_bytes', function()
|
||||
}
|
||||
end)
|
||||
|
||||
local function test_lockmarks(mode)
|
||||
local description = (mode ~= "") and mode or "(baseline)"
|
||||
it("test_lockmarks " .. description .. " %delete _", function()
|
||||
local check_events = setup_eventcheck(verify, {"AAA", "BBB", "CCC"})
|
||||
|
||||
command(mode .. " %delete _")
|
||||
check_events {
|
||||
{ "test1", "bytes", 1, 3, 0, 0, 0, 3, 0, 12, 1, 0, 1 };
|
||||
}
|
||||
end)
|
||||
|
||||
it("test_lockmarks " .. description .. " append()", function()
|
||||
local check_events = setup_eventcheck(verify)
|
||||
|
||||
command(mode .. " call append(0, 'CCC')")
|
||||
check_events {
|
||||
{ "test1", "bytes", 1, 2, 0, 0, 0, 0, 0, 0, 1, 0, 4 };
|
||||
}
|
||||
|
||||
command(mode .. " call append(1, 'BBBB')")
|
||||
check_events {
|
||||
{ "test1", "bytes", 1, 3, 1, 0, 4, 0, 0, 0, 1, 0, 5 };
|
||||
}
|
||||
|
||||
command(mode .. " call append(2, '')")
|
||||
check_events {
|
||||
{ "test1", "bytes", 1, 4, 2, 0, 9, 0, 0, 0, 1, 0, 1 };
|
||||
}
|
||||
|
||||
command(mode .. " $delete _")
|
||||
check_events {
|
||||
{ "test1", "bytes", 1, 5, 3, 0, 10, 1, 0, 1, 0, 0, 0 };
|
||||
}
|
||||
|
||||
eq("CCC|BBBB|", table.concat(meths.buf_get_lines(0, 0, -1, true), "|"))
|
||||
end)
|
||||
end
|
||||
|
||||
-- check that behavior is identical with and without "lockmarks"
|
||||
test_lockmarks ""
|
||||
test_lockmarks "lockmarks"
|
||||
|
||||
teardown(function()
|
||||
os.remove "Xtest-reload"
|
||||
os.remove "Xtest-undofile"
|
||||
|
Loading…
Reference in New Issue
Block a user