mirror of
https://github.com/neovim/neovim.git
synced 2026-05-24 13:50:06 +00:00
fix(shada): set correct buffer number for local marks on read #39712
Problem: After closing and reopening Neovim, ]' and [' fail with E92: Buffer 0 not found for marks restored from ShaDa. Direct jumps like 'a work because mark_get_local() rewrites fnum before returning, but ]' uses getnextmark() which does not, leaving fnum = 0. Solution: Set .fnum = buf->b_fnum when restoring local marks from ShaDa.
This commit is contained in:
committed by
GitHub
parent
54f22a8f01
commit
0b96b3cd52
@@ -1180,7 +1180,7 @@ static void shada_read(FileDescriptor *const sd_reader, const int flags)
|
||||
}
|
||||
const fmark_T fm = (fmark_T) {
|
||||
.mark = cur_entry.data.filemark.mark,
|
||||
.fnum = 0,
|
||||
.fnum = buf->b_fnum,
|
||||
.timestamp = cur_entry.timestamp,
|
||||
.view = INIT_FMARKV,
|
||||
.additional_data = cur_entry.additional_data,
|
||||
|
||||
@@ -189,6 +189,17 @@ describe('ShaDa support code', function()
|
||||
eq(2, nvim_current_line())
|
||||
end)
|
||||
|
||||
it("is able to dump, read back local mark and use `]'`", function()
|
||||
nvim_command('edit ' .. testfilename)
|
||||
nvim_command('2')
|
||||
nvim_command('mark a')
|
||||
expect_exit(nvim_command, 'qall')
|
||||
reset({ args = { testfilename } })
|
||||
eq(1, nvim_current_line())
|
||||
nvim_command("normal! ]'")
|
||||
eq(2, nvim_current_line())
|
||||
end)
|
||||
|
||||
it('is able to dump and read back mark " from a closed tab', function()
|
||||
nvim_command('edit ' .. testfilename)
|
||||
nvim_command('tabedit ' .. testfilename_2)
|
||||
|
||||
Reference in New Issue
Block a user