mirror of
https://github.com/neovim/neovim.git
synced 2026-02-21 09:50:19 +10:00
fix(normal): assertion failure with "gk" in narrow window (#37444)
When width1 and width2 are negative the assertion may fail. It seems
that adding a negative value to w_curswant won't cause any problems, so
just change the assertion.
(cherry picked from commit 41068c77aa)
This commit is contained in:
committed by
github-actions[bot]
parent
1db945b584
commit
6ef1b655fe
@@ -2562,7 +2562,7 @@ bool nv_screengo(oparg_T *oap, int dir, int dist, bool skip_conceal)
|
||||
linelen = linetabsize(curwin, curwin->w_cursor.lnum);
|
||||
if (linelen > width1) {
|
||||
int w = (((linelen - width1 - 1) / width2) + 1) * width2;
|
||||
assert(curwin->w_curswant <= INT_MAX - w);
|
||||
assert(w <= 0 || curwin->w_curswant <= INT_MAX - w);
|
||||
curwin->w_curswant += w;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,4 +59,11 @@ describe('Normal mode', function()
|
||||
|
|
||||
]])
|
||||
end)
|
||||
|
||||
it('"gk" does not crash with signcolumn=yes in narrow window #31274', function()
|
||||
feed('o<Esc>')
|
||||
command('1vsplit | setlocal signcolumn=yes')
|
||||
feed('gk')
|
||||
n.assert_alive()
|
||||
end)
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user