Merge pull request #15946 from bfredl/issue-12861

fix(buffer_updates): make lockmarks not affect extmarks and buffer updates
This commit is contained in:
Björn Linse 2021-10-07 20:52:10 +02:00 committed by GitHub
commit 2d206d5ab2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 46 additions and 3 deletions

View File

@ -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

View File

@ -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"