summaryrefslogtreecommitdiffstats
path: root/src/move.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-05-11 11:23:37 +0200
committerChristian Brabandt <cb@256bit.org>2024-05-11 11:23:37 +0200
commit031a745608d615d56f9d79bb0f76e2a74b2eaf14 (patch)
tree93fb1e4f968bbd3e4a08e18b6e5fa7dd98ac9b64 /src/move.c
parent1c5728e0c4a9df930879f9f0ca108092d5902194 (diff)
patch 9.1.0406: Divide by zero with getmousepos() and 'smoothscroll'v9.1.0406
Problem: Divide by zero with getmousepos() and 'smoothscroll'. Solution: Don't compute skip_lines when width1 is zero. (zeertzjq) closes: #14747 Signed-off-by: zeertzjq <zeertzjq@outlook.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
Diffstat (limited to 'src/move.c')
-rw-r--r--src/move.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/move.c b/src/move.c
index 6790192ab5..797184812a 100644
--- a/src/move.c
+++ b/src/move.c
@@ -2617,12 +2617,14 @@ scroll_cursor_bot(int min_scroll, int set_topbot)
plines_win
#endif
(curwin, curwin->w_topline, FALSE);
- int skip_lines = 0;
int width1 = curwin->w_width - curwin_col_off();
+
if (width1 > 0)
{
int width2 = width1 + curwin_col_off2();
- // similar formula is used in curs_columns()
+ int skip_lines = 0;
+
+ // A similar formula is used in curs_columns().
if (curwin->w_skipcol > width1)
skip_lines += (curwin->w_skipcol - width1) / width2 + 1;
else if (curwin->w_skipcol > 0)