mirror of
https://github.com/neovim/neovim.git
synced 2024-12-23 12:45:17 -07:00
fix(mark): properly init mark views (#22996)
This commit is contained in:
parent
bd98ef6ac6
commit
0451391ec5
@ -84,7 +84,7 @@ void clear_fmark(fmark_T *fm)
|
||||
FUNC_ATTR_NONNULL_ALL
|
||||
{
|
||||
free_fmark(*fm);
|
||||
CLEAR_POINTER(fm);
|
||||
*fm = (fmark_T)INIT_FMARK;
|
||||
}
|
||||
|
||||
// Set named mark "c" to position "pos".
|
||||
|
@ -36,7 +36,7 @@
|
||||
|
||||
/// Clear given fmark
|
||||
#define CLEAR_FMARK(fmarkp_) \
|
||||
RESET_FMARK(fmarkp_, ((pos_T) { 0, 0, 0 }), 0, ((fmarkv_T) { 0 }))
|
||||
RESET_FMARK(fmarkp_, ((pos_T) { 0, 0, 0 }), 0, ((fmarkv_T)INIT_FMARKV))
|
||||
|
||||
/// Set given extended mark (regular mark + file name)
|
||||
#define SET_XFMARK(xfmarkp_, mark_, fnum_, view_, fname_) \
|
||||
|
@ -1307,6 +1307,7 @@ static void shada_read(ShaDaReadDef *const sd_reader, const int flags)
|
||||
.mark = cur_entry.data.filemark.mark,
|
||||
.fnum = (buf == NULL ? 0 : buf->b_fnum),
|
||||
.timestamp = cur_entry.timestamp,
|
||||
.view = INIT_FMARKV,
|
||||
.additional_data = cur_entry.data.filemark.additional_data,
|
||||
},
|
||||
};
|
||||
@ -1388,6 +1389,7 @@ static void shada_read(ShaDaReadDef *const sd_reader, const int flags)
|
||||
.mark = cur_entry.data.filemark.mark,
|
||||
.fnum = 0,
|
||||
.timestamp = cur_entry.timestamp,
|
||||
.view = INIT_FMARKV,
|
||||
.additional_data = cur_entry.data.filemark.additional_data,
|
||||
};
|
||||
if (cur_entry.type == kSDItemLocalMark) {
|
||||
|
@ -417,4 +417,48 @@ describe('named marks view', function()
|
||||
|
|
||||
]])
|
||||
end)
|
||||
|
||||
it('fallback to standard behavior when mark is loaded from shada', function()
|
||||
local screen = Screen.new(10, 6)
|
||||
screen:attach()
|
||||
command('edit ' .. file1)
|
||||
feed('G')
|
||||
feed('mA')
|
||||
screen:expect([[
|
||||
26 line |
|
||||
27 line |
|
||||
28 line |
|
||||
29 line |
|
||||
^30 line |
|
||||
|
|
||||
]])
|
||||
command('set shadafile=Xtestfile-functional-editor-marks-shada')
|
||||
finally(function()
|
||||
command('set shadafile=NONE')
|
||||
os.remove('Xtestfile-functional-editor-marks-shada')
|
||||
end)
|
||||
command('wshada!')
|
||||
command('bwipe!')
|
||||
screen:expect([[
|
||||
^ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
~ |
|
||||
|
|
||||
]])
|
||||
command('rshada!')
|
||||
command('edit ' .. file1)
|
||||
feed('`"')
|
||||
screen:expect([[
|
||||
26 line |
|
||||
27 line |
|
||||
28 line |
|
||||
29 line |
|
||||
^30 line |
|
||||
|
|
||||
]])
|
||||
feed('`A')
|
||||
screen:expect_unchanged()
|
||||
end)
|
||||
end)
|
||||
|
Loading…
Reference in New Issue
Block a user