mirror of
https://github.com/neovim/neovim.git
synced 2025-10-03 16:36:30 +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;
|
fname = fm.fname;
|
||||||
} else {
|
} else {
|
||||||
const buf_T *const buf = buflist_findnr(fm.fmark.fnum);
|
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;
|
continue;
|
||||||
}
|
}
|
||||||
fname = buf->b_ffname;
|
fname = buf->b_ffname;
|
||||||
|
@@ -418,4 +418,30 @@ describe('ShaDa support code', function()
|
|||||||
-- Make sure that uppercase marks aren't deleted.
|
-- Make sure that uppercase marks aren't deleted.
|
||||||
nvim_command('normal! `A')
|
nvim_command('normal! `A')
|
||||||
end)
|
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)
|
end)
|
||||||
|
Reference in New Issue
Block a user