commit 41068c77aa1b221bc4f4321ac0dfe55e13a9f27f
parent a5e5ec8910ea35ebb86dcba7f58333d9d4caca47
Author: zeertzjq <zeertzjq@outlook.com>
Date: Sun, 18 Jan 2026 11:46:13 +0800
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.
Diffstat:
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/src/nvim/normal.c b/src/nvim/normal.c
@@ -2564,7 +2564,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;
}
}
diff --git a/test/functional/editor/mode_normal_spec.lua b/test/functional/editor/mode_normal_spec.lua
@@ -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)