mirror of
https://github.com/neovim/neovim.git
synced 2026-08-30 02:51:48 +00:00
fix(buffer): switching buffer should respect jumpoptions+=view (#36969)
Also add missing change to buflist_findfmark() from #19224.
(cherry picked from commit 2700f6642a)
This commit is contained in:
committed by
github-actions[bot]
parent
45cda1bcf4
commit
6f84ea7c66
@@ -2219,7 +2219,8 @@ int buflist_getfile(int n, linenr_T lnum, int options, int forceit)
|
||||
/// Go to the last known line number for the current buffer.
|
||||
void buflist_getfpos(void)
|
||||
{
|
||||
pos_T *fpos = &buflist_findfmark(curbuf)->mark;
|
||||
fmark_T *fm = buflist_findfmark(curbuf);
|
||||
const pos_T *fpos = &fm->mark;
|
||||
|
||||
curwin->w_cursor.lnum = fpos->lnum;
|
||||
check_cursor_lnum(curwin);
|
||||
@@ -2232,6 +2233,10 @@ void buflist_getfpos(void)
|
||||
curwin->w_cursor.coladd = 0;
|
||||
curwin->w_set_curswant = true;
|
||||
}
|
||||
|
||||
if (jop_flags & kOptJopFlagView) {
|
||||
mark_view_restore(fm);
|
||||
}
|
||||
}
|
||||
|
||||
/// Find file in buffer list by name (it has to be for the current window).
|
||||
@@ -2812,7 +2817,7 @@ void get_winopts(buf_T *buf)
|
||||
fmark_T *buflist_findfmark(buf_T *buf)
|
||||
FUNC_ATTR_PURE
|
||||
{
|
||||
static fmark_T no_position = { { 1, 0, 0 }, 0, 0, { 0 }, NULL };
|
||||
static fmark_T no_position = { { 1, 0, 0 }, 0, 0, INIT_FMARKV, NULL };
|
||||
|
||||
WinInfo *const wip = find_wininfo(buf, false, false);
|
||||
return (wip == NULL) ? &no_position : &(wip->wi_mark);
|
||||
|
||||
Reference in New Issue
Block a user