0
0
mirror of https://github.com/vim/vim.git synced 2025-09-26 04:04:07 -04:00

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.
This commit is contained in:
Bram Moolenaar
2019-06-26 03:40:36 +02:00
parent c2a4316500
commit 68acb41f99
12 changed files with 86 additions and 18 deletions

View File

@@ -1547,6 +1547,7 @@ f_popup_getpos(typval_T *argvars, typval_T *rettv)
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 @@ update_popups(void (*win_update)(win_T *wp))
{
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];