Skip to content

Commit 076d988

Browse files
committed
patch 8.1.2032: scrollbar thumb wrong in popup window
Problem: Scrollbar thumb wrong in popup window. Solution: Adjust thumb size and position when scrolled.
1 parent 5babc6e commit 076d988

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

src/popupwin.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3363,10 +3363,12 @@ update_popups(void (*win_update)(win_T *wp))
33633363
// Compute scrollbar thumb position and size.
33643364
if (wp->w_has_scrollbar)
33653365
{
3366-
linenr_T linecount = wp->w_buffer->b_ml.ml_line_count;
3366+
linenr_T linecount = wp->w_buffer->b_ml.ml_line_count;
3367+
int height = wp->w_height;
33673368

3368-
sb_thumb_height = (wp->w_height * wp->w_height + linecount / 2)
3369-
/ linecount;
3369+
sb_thumb_height = (height * height + linecount / 2) / linecount;
3370+
if (wp->w_topline > 1 && sb_thumb_height == height)
3371+
--sb_thumb_height; // scrolled, no full thumb
33703372
if (sb_thumb_height == 0)
33713373
sb_thumb_height = 1;
33723374
if (linecount <= wp->w_height)
@@ -3377,6 +3379,9 @@ update_popups(void (*win_update)(win_T *wp))
33773379
+ (linecount / wp->w_height) / 2)
33783380
* (wp->w_height - sb_thumb_height)
33793381
/ (linecount - wp->w_height);
3382+
if (wp->w_topline > 1 && sb_thumb_top == 0 && height > 1)
3383+
sb_thumb_top = 1; // show it's scrolled
3384+
33803385
if (wp->w_scrollbar_highlight != NULL)
33813386
attr_scroll = syn_name2attr(wp->w_scrollbar_highlight);
33823387
else

src/testdir/dumps/Test_popupwin_scroll_2.dump

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
>1+0&#ffffff0| @73
22
|2| @73
33
|3| @73
4-
|4| @31|t+0#0000001#ffd7ff255|w|o| @4| +0#0000000#0000001| +0&#ffffff0@32
4+
|4| @31|t+0#0000001#ffd7ff255|w|o| @4| +0#0000000#a8a8a8255| +0&#ffffff0@32
55
|5| @31|t+0#0000001#ffd7ff255|h|r|e@1| @2| +0#0000000#0000001| +0&#ffffff0@32
6-
|6| @31|f+0#0000001#ffd7ff255|o|u|r| @3| +0#0000000#a8a8a8255| +0&#ffffff0@32
6+
|6| @31|f+0#0000001#ffd7ff255|o|u|r| @3| +0#0000000#0000001| +0&#ffffff0@32
77
|7| @31|f+0#0000001#ffd7ff255|i|v|e| @3| +0#0000000#a8a8a8255| +0&#ffffff0@32
88
|8| @73
99
|9| @73

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -757,6 +757,8 @@ static char *(features[]) =
757757

758758
static int included_patches[] =
759759
{ /* Add new patch number below this line */
760+
/**/
761+
2032,
760762
/**/
761763
2031,
762764
/**/

0 commit comments

Comments
 (0)