]> granicus.if.org Git - vim/commitdiff
patch 8.1.2032: scrollbar thumb wrong in popup window v8.1.2032
authorBram Moolenaar <Bram@vim.org>
Sat, 14 Sep 2019 20:23:29 +0000 (22:23 +0200)
committerBram Moolenaar <Bram@vim.org>
Sat, 14 Sep 2019 20:23:29 +0000 (22:23 +0200)
Problem:    Scrollbar thumb wrong in popup window.
Solution:   Adjust thumb size and position when scrolled.

src/popupwin.c
src/testdir/dumps/Test_popupwin_scroll_2.dump
src/version.c

index 066720040b7d475512dec923ce6fbd3f8c85e711..81cc17f2d80d4b5bc768c081f233b1818ce336c2 100644 (file)
@@ -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
index 3b2145e90f3766bec6d25866e2e2ec2a371be368..227ba6c46b63e92c2cfa5ebf7883d3f699715d35 100644 (file)
@@ -1,9 +1,9 @@
 >1+0&#ffffff0| @73
 |2| @73
 |3| @73
-|4| @31|t+0#0000001#ffd7ff255|w|o| @4| +0#0000000#0000001| +0&#ffffff0@32
+|4| @31|t+0#0000001#ffd7ff255|w|o| @4| +0#0000000#a8a8a8255| +0&#ffffff0@32
 |5| @31|t+0#0000001#ffd7ff255|h|r|e@1| @2| +0#0000000#0000001| +0&#ffffff0@32
-|6| @31|f+0#0000001#ffd7ff255|o|u|r| @3| +0#0000000#a8a8a8255| +0&#ffffff0@32
+|6| @31|f+0#0000001#ffd7ff255|o|u|r| @3| +0#0000000#0000001| +0&#ffffff0@32
 |7| @31|f+0#0000001#ffd7ff255|i|v|e| @3| +0#0000000#a8a8a8255| +0&#ffffff0@32
 |8| @73
 |9| @73
index 61e41bd60bc5b039e49efc231128281a4f4f12ff..0c6b2d8cafdcbacd7a4bac16aa0c6c8bdd64e6c9 100644 (file)
@@ -757,6 +757,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2032,
 /**/
     2031,
 /**/