diff --git a/src/nvim/shada.c b/src/nvim/shada.c index 7034c84908..4ca8ead9fa 100644 --- a/src/nvim/shada.c +++ b/src/nvim/shada.c @@ -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, diff --git a/test/functional/shada/marks_spec.lua b/test/functional/shada/marks_spec.lua index e7215a8a40..8ec73b8daf 100644 --- a/test/functional/shada/marks_spec.lua +++ b/test/functional/shada/marks_spec.lua @@ -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)