mirror of
https://github.com/vim/vim.git
synced 2025-09-26 04:04:07 -04:00
patch 9.1.0406: Divide by zero with getmousepos() and 'smoothscroll'
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>
This commit is contained in:
committed by
Christian Brabandt
parent
1c5728e0c4
commit
031a745608
22
src/mouse.c
22
src/mouse.c
@@ -3029,16 +3029,22 @@ mouse_comp_pos(
|
||||
|
||||
if (win->w_skipcol > 0 && lnum == win->w_topline)
|
||||
{
|
||||
// Adjust for 'smoothscroll' clipping the top screen lines.
|
||||
// A similar formula is used in curs_columns().
|
||||
int width1 = win->w_width - win_col_off(win);
|
||||
int skip_lines = 0;
|
||||
if (win->w_skipcol > width1)
|
||||
skip_lines = (win->w_skipcol - width1)
|
||||
|
||||
if (width1 > 0)
|
||||
{
|
||||
int skip_lines = 0;
|
||||
|
||||
// Adjust for 'smoothscroll' clipping the top screen lines.
|
||||
// A similar formula is used in curs_columns().
|
||||
if (win->w_skipcol > width1)
|
||||
skip_lines = (win->w_skipcol - width1)
|
||||
/ (width1 + win_col_off2(win)) + 1;
|
||||
else if (win->w_skipcol > 0)
|
||||
skip_lines = 1;
|
||||
count -= skip_lines;
|
||||
else if (win->w_skipcol > 0)
|
||||
skip_lines = 1;
|
||||
|
||||
count -= skip_lines;
|
||||
}
|
||||
}
|
||||
|
||||
if (count > row)
|
||||
|
Reference in New Issue
Block a user