fix(api): allow nvim_buf_set_extmark to accept end_row key (#16686)

nvim_buf_get_extmark uses "end_row" rather than "end_line" in its
'details' dict, which means callers must modify the key names if they
want to re-use the information. Allow nvim_buf_set_extmark to take
"end_row" as an alias to "end_line" to make this more compatible.

See [1].

[1]: https://github.com/neovim/neovim/pull/15011#discussion_r665336968
This commit is contained in:
github-actions[bot]
2021-12-16 11:05:58 -07:00
committed by GitHub
parent 5c8e5432c0
commit 1b54344c11
4 changed files with 30 additions and 11 deletions

View File

@@ -104,10 +104,10 @@ describe('API/extmarks', function()
it("can end extranges past final newline using end_col = 0", function()
set_extmark(ns, marks[1], 0, 0, {
end_col = 0,
end_line = 1
end_row = 1
})
eq("end_col value outside range",
pcall_err(set_extmark, ns, marks[2], 0, 0, { end_col = 1, end_line = 1 }))
pcall_err(set_extmark, ns, marks[2], 0, 0, { end_col = 1, end_row = 1 }))
end)
it('adds, updates and deletes marks', function()
@@ -1424,6 +1424,14 @@ describe('API/extmarks', function()
eq({ {1, 0, 0}, {2, 0, 8} },
meths.buf_get_extmarks(0, ns, 0, -1, {}))
end)
it('can accept "end_row" or "end_line" #16548', function()
set_extmark(ns, marks[1], 0, 0, {
end_col = 0,
end_line = 1
})
eq({ {1, 0, 0, { end_col = 0, end_row = 1 }} }, get_extmarks(ns, 0, -1, {details=true}))
end)
end)
describe('Extmarks buffer api with many marks', function()