diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-09-14 22:23:29 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-09-14 22:23:29 +0200 |
commit | 076d98839c4f6f15ae3563263057aa99ff04a869 (patch) | |
tree | b980cce0ef29ef32998aba1cf6c80cbc03270109 /src/popupwin.c | |
parent | 5babc6e858afbfa54aa0e203a64b9c70175487b7 (diff) | |
download | vim-git-076d98839c4f6f15ae3563263057aa99ff04a869.tar.gz |
patch 8.1.2032: scrollbar thumb wrong in popup windowv8.1.2032
Problem: Scrollbar thumb wrong in popup window.
Solution: Adjust thumb size and position when scrolled.
Diffstat (limited to 'src/popupwin.c')
-rw-r--r-- | src/popupwin.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/popupwin.c b/src/popupwin.c index 066720040..81cc17f2d 100644 --- a/src/popupwin.c +++ b/src/popupwin.c @@ -3363,10 +3363,12 @@ update_popups(void (*win_update)(win_T *wp)) // Compute scrollbar thumb position and size. if (wp->w_has_scrollbar) { - linenr_T linecount = wp->w_buffer->b_ml.ml_line_count; + linenr_T linecount = wp->w_buffer->b_ml.ml_line_count; + int height = wp->w_height; - sb_thumb_height = (wp->w_height * wp->w_height + linecount / 2) - / linecount; + sb_thumb_height = (height * height + linecount / 2) / linecount; + if (wp->w_topline > 1 && sb_thumb_height == height) + --sb_thumb_height; // scrolled, no full thumb if (sb_thumb_height == 0) sb_thumb_height = 1; if (linecount <= wp->w_height) @@ -3377,6 +3379,9 @@ update_popups(void (*win_update)(win_T *wp)) + (linecount / wp->w_height) / 2) * (wp->w_height - sb_thumb_height) / (linecount - wp->w_height); + if (wp->w_topline > 1 && sb_thumb_top == 0 && height > 1) + sb_thumb_top = 1; // show it's scrolled + if (wp->w_scrollbar_highlight != NULL) attr_scroll = syn_name2attr(wp->w_scrollbar_highlight); else |