mirror of
https://github.com/neovim/neovim.git
synced 2025-10-03 00:18:33 +00:00
fix(shada): preserve marks after delete across sessions (#35795)
Problem: Marks are lost after `:bdelete` because `ignore_buf()` filters out unlisted buffers during shada mark processing. Solution: Revert to original buffer checks for mark operations, avoiding `!buf->b_p_bl` condition that incorrectly ignores deleted buffers.
This commit is contained in:
@@ -2443,7 +2443,8 @@ static ShaDaWriteResult shada_write(FileDescriptor *const sd_writer,
|
||||
fname = fm.fname;
|
||||
} else {
|
||||
const buf_T *const buf = buflist_findnr(fm.fmark.fnum);
|
||||
if (ignore_buf(buf, &removable_bufs)) {
|
||||
if (buf == NULL || buf->b_ffname == NULL
|
||||
|| set_has(ptr_t, &removable_bufs, (ptr_t)buf)) {
|
||||
continue;
|
||||
}
|
||||
fname = buf->b_ffname;
|
||||
|
@@ -418,4 +418,30 @@ describe('ShaDa support code', function()
|
||||
-- Make sure that uppercase marks aren't deleted.
|
||||
nvim_command('normal! `A')
|
||||
end)
|
||||
|
||||
it('preserves marks after :bdelete #35770', function()
|
||||
nvim_command('edit foo')
|
||||
nvim_command('mark X')
|
||||
nvim_command('bdelete')
|
||||
nvim_command('wshada')
|
||||
|
||||
reset()
|
||||
local mX = api.nvim_get_mark('X', {})
|
||||
t.matches(vim.pesc('foo'), mX[4])
|
||||
|
||||
nvim_command('delmarks X')
|
||||
nvim_command('edit foo')
|
||||
nvim_command('mark X')
|
||||
nvim_command('edit bar')
|
||||
nvim_command('mark Y')
|
||||
nvim_command('bufdo bdelete')
|
||||
nvim_command('edit foo')
|
||||
nvim_command('wshada')
|
||||
|
||||
reset()
|
||||
mX = api.nvim_get_mark('X', {})
|
||||
local mY = api.nvim_get_mark('Y', {})
|
||||
t.matches(vim.pesc('foo'), mX[4])
|
||||
t.matches(vim.pesc('bar'), mY[4])
|
||||
end)
|
||||
end)
|
||||
|
Reference in New Issue
Block a user