feat(shada): shada should not store nobuflisted buffers #21818

Problem:  Shada jumplist entries still include entries from e.g. 'nobuflisted' buffers.
Solution: Check `ignore_buf()` before adding jumplist entries, followup to b98eefd8.

Co-authored-by: Luuk van Baal <luukvbaal@gmail.com>
This commit is contained in:
Leonhard Kipp
2025-07-09 18:33:20 +02:00
committed by GitHub
parent 3a3484be29
commit 840cdb9589
2 changed files with 16 additions and 6 deletions

View File

@ -213,6 +213,20 @@ describe('ShaDa support code', function()
eq({}, find_file(fname))
end)
it("does not store 'nobuflisted' buffer", function()
nvim_command('set shellslash')
local fname = fn.getcwd() .. '/file'
api.nvim_set_var('__fname', fname)
nvim_command('edit `=__fname`')
api.nvim_set_option_value('buflisted', false, {})
nvim_command('wshada! ' .. shada_fname)
eq({}, find_file(fname))
-- Set 'buflisted', then check again.
api.nvim_set_option_value('buflisted', true, {})
nvim_command('wshada! ' .. shada_fname)
eq({ [7] = 1, [8] = 1, [10] = 1 }, find_file(fname))
end)
it('is able to set &shada after &viminfo', function()
api.nvim_set_option_value('viminfo', "'10", {})
eq("'10", api.nvim_get_option_value('viminfo', {}))