patch 8.1.1597: cannot scroll a popup window with the mouse
Problem: Cannot scroll a popup window with the mouse.
Solution: If the popup window has a scrollbar let the mouse scroll wheel
scroll the window.
diff --git a/src/popupwin.c b/src/popupwin.c
index b9526c7..5611cba 100644
--- a/src/popupwin.c
+++ b/src/popupwin.c
@@ -1547,6 +1547,7 @@
dict_add_number(dict, "core_height", wp->w_height);
dict_add_number(dict, "scrollbar", wp->w_has_scrollbar);
+ dict_add_number(dict, "firstline", wp->w_topline);
dict_add_number(dict, "visible",
win_valid(wp) && (wp->w_popup_flags & POPF_HIDDEN) == 0);
}
@@ -2238,12 +2239,13 @@
{
linenr_T linecount = wp->w_buffer->b_ml.ml_line_count;
- sb_thumb_height = wp->w_height * wp->w_height / linecount;
+ sb_thumb_height = (wp->w_height * wp->w_height + linecount / 2)
+ / linecount;
if (sb_thumb_height == 0)
sb_thumb_height = 1;
- sb_thumb_top = ((wp->w_topline * (wp->w_height - sb_thumb_height)
- + (linecount - wp->w_height) / 2))
- / (linecount - (wp->w_height - sb_thumb_height));
+ sb_thumb_top = (wp->w_topline - 1 + (linecount / wp->w_height) / 2)
+ * (wp->w_height - sb_thumb_height)
+ / (linecount - wp->w_height);
}
for (i = wp->w_popup_border[0];