fix(shada): prevent 'nobuflisted' buffers in v:oldfiles #34373

Problem: 'nobuflisted' buffers are incorrectly added to v:oldfiles.

Solution: Use ignore_buf() consistently in shada_write() for buffer
marks processing.
This commit is contained in:
glepnir
2025-06-10 21:50:16 +08:00
committed by GitHub
parent 93925fe020
commit b98eefd803
2 changed files with 17 additions and 4 deletions

View File

@ -91,4 +91,18 @@ describe('shada support code', function()
eq('', fn.bufname(1))
eq(testfilename, fn.bufname(2))
end)
it("does not add 'nobuflisted' buffers to v:oldfiles", function()
reset("set shada='100")
nvim_command('edit ' .. testfilename)
nvim_command('setlocal nobuflisted')
nvim_command('edit ' .. testfilename_2)
nvim_command('setlocal buflisted')
nvim_command('write')
expect_exit(nvim_command, 'qall')
reset("set shada='100")
local oldfiles = api.nvim_get_vvar('oldfiles')
eq(1, #oldfiles)
t.matches(vim.pesc(testfilename_2), oldfiles[1])
end)
end)