mirror of
https://github.com/neovim/neovim.git
synced 2025-10-21 09:12:07 +00:00
refactor(api/marks)!: add opts param for feature extensibility (#16146)
In the future we might want to extend the concept of named marks and adding opts reduces the need of changing the function signature in the furute.
This commit is contained in:
@@ -2389,7 +2389,7 @@ describe('API', function()
|
||||
it('works', function()
|
||||
local buf = meths.create_buf(false,true)
|
||||
meths.buf_set_lines(buf, -1, -1, true, {'a', 'bit of', 'text'})
|
||||
eq(true, meths.buf_set_mark(buf, 'F', 2, 2))
|
||||
eq(true, meths.buf_set_mark(buf, 'F', 2, 2, {}))
|
||||
eq(true, meths.del_mark('F'))
|
||||
eq({0, 0}, meths.buf_get_mark(buf, 'F'))
|
||||
end)
|
||||
@@ -2403,9 +2403,9 @@ describe('API', function()
|
||||
it('works', function()
|
||||
local buf = meths.create_buf(false,true)
|
||||
meths.buf_set_lines(buf, -1, -1, true, {'a', 'bit of', 'text'})
|
||||
meths.buf_set_mark(buf, 'F', 2, 2)
|
||||
meths.buf_set_mark(buf, 'F', 2, 2, {})
|
||||
meths.buf_set_name(buf, "mybuf")
|
||||
local mark = meths.get_mark('F')
|
||||
local mark = meths.get_mark('F', {})
|
||||
-- Compare the path tail ony
|
||||
assert(string.find(mark[4], "mybuf$"))
|
||||
eq({2, 2, buf.id, mark[4]}, mark)
|
||||
@@ -2417,7 +2417,7 @@ describe('API', function()
|
||||
end)
|
||||
it('returns the expected when mark is not set', function()
|
||||
eq(true, meths.del_mark('A'))
|
||||
eq({0, 0, 0, ''}, meths.get_mark('A'))
|
||||
eq({0, 0, 0, ''}, meths.get_mark('A', {}))
|
||||
end)
|
||||
it('works with deleted buffers', function()
|
||||
local fname = tmpname()
|
||||
@@ -2425,12 +2425,12 @@ describe('API', function()
|
||||
nvim("command", "edit " .. fname)
|
||||
local buf = meths.get_current_buf()
|
||||
|
||||
meths.buf_set_mark(buf, 'F', 2, 2)
|
||||
meths.buf_set_mark(buf, 'F', 2, 2, {})
|
||||
nvim("command", "new") -- Create new buf to avoid :bd failing
|
||||
nvim("command", "bd! " .. buf.id)
|
||||
os.remove(fname)
|
||||
|
||||
local mark = meths.get_mark('F')
|
||||
local mark = meths.get_mark('F', {})
|
||||
-- To avoid comparing relative vs absolute path
|
||||
local mfname = mark[4]
|
||||
local tail_patt = [[[\/][^\/]*$]]
|
||||
|
Reference in New Issue
Block a user