summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-05-29 18:18:18 +0100
committerBram Moolenaar <Bram@vim.org>2022-05-29 18:18:18 +0100
commitfc376e0b1a36a2ef153e28752c61342554386886 (patch)
treec64e8b0af3932be44d0736018afecfab95d3ff16 /src
parent83bd7a974056fd61e142c791e79d9dd89acd5ba4 (diff)
patch 8.2.5040: scrollbar thumb in scrolled popup not visiblev8.2.5040
Problem: Scrollbar thumb in scrolled popup not visible. Solution: Show at least one thumb character. (fixes 10492)
Diffstat (limited to 'src')
-rw-r--r--src/popupwin.c5
-rw-r--r--src/testdir/dumps/Test_popupwin_scroll_13.dump10
-rw-r--r--src/testdir/test_popupwin.vim13
-rw-r--r--src/version.c2
4 files changed, 28 insertions, 2 deletions
diff --git a/src/popupwin.c b/src/popupwin.c
index 5074eaa652..a011b39ecb 100644
--- a/src/popupwin.c
+++ b/src/popupwin.c
@@ -4087,6 +4087,7 @@ update_popups(void (*win_update)(win_T *wp))
{
linenr_T linecount = wp->w_buffer->b_ml.ml_line_count;
int height = wp->w_height;
+ int last;
sb_thumb_height = ((linenr_T)height * height + linecount / 2)
/ linecount;
@@ -4104,6 +4105,10 @@ update_popups(void (*win_update)(win_T *wp))
/ (linecount - wp->w_height);
if (wp->w_topline > 1 && sb_thumb_top == 0 && height > 1)
sb_thumb_top = 1; // show it's scrolled
+ last = total_height - top_off - wp->w_popup_border[2];
+ if (sb_thumb_top >= last)
+ // show at least one character
+ sb_thumb_top = last;
if (wp->w_scrollbar_highlight != NULL)
attr_scroll = syn_name2attr(wp->w_scrollbar_highlight);
diff --git a/src/testdir/dumps/Test_popupwin_scroll_13.dump b/src/testdir/dumps/Test_popupwin_scroll_13.dump
new file mode 100644
index 0000000000..c168da26f4
--- /dev/null
+++ b/src/testdir/dumps/Test_popupwin_scroll_13.dump
@@ -0,0 +1,10 @@
+>1+0&#ffffff0| @73
+|2| @73
+|3| @73
+|4| @20|1+0#0000001#ffd7ff255|9| @27| +0#0000000#a8a8a8255| +0&#ffffff0@21
+|5| @20| +0#4040ff13#ffd7ff255@29| +0#0000000#a8a8a8255| +0&#ffffff0@21
+|6| @20| +0#4040ff13#ffd7ff255@29| +0#0000000#a8a8a8255| +0&#ffffff0@21
+|7| @20| +0#4040ff13#ffd7ff255@29| +0#0000000#0000001| +0&#ffffff0@21
+|8| @73
+|9| @73
+|:|c|a|l@1| |S|c|r|o|l@1|B|o|t@1|o|m|(|)| @36|1|,|1| @10|T|o|p|
diff --git a/src/testdir/test_popupwin.vim b/src/testdir/test_popupwin.vim
index a78816b80f..d3a57b04b0 100644
--- a/src/testdir/test_popupwin.vim
+++ b/src/testdir/test_popupwin.vim
@@ -2314,8 +2314,8 @@ func Test_popup_scrollbar()
endif
endfunc
- def CreatePopup(text: list<string>)
- popup_create(text, {
+ def CreatePopup(text: list<string>): number
+ return popup_create(text, {
\ minwidth: 30,
\ maxwidth: 30,
\ minheight: 4,
@@ -2342,6 +2342,11 @@ func Test_popup_scrollbar()
END
call CreatePopup(text)
endfunc
+ func ScrollBottom()
+ call popup_clear()
+ let id = CreatePopup(range(20)->map({k, v -> string(v)}))
+ call popup_setoptions(id, #{firstline: 20})
+ endfunc
map <silent> <F3> :call test_setmouse(5, 36)<CR>
map <silent> <F4> :call test_setmouse(4, 42)<CR>
map <silent> <F5> :call test_setmouse(7, 42)<CR>
@@ -2397,6 +2402,10 @@ func Test_popup_scrollbar()
call term_sendkeys(buf, "j")
call VerifyScreenDump(buf, 'Test_popupwin_scroll_12', {})
+ " check thumb when scrolled all the way down
+ call term_sendkeys(buf, ":call ScrollBottom()\<CR>")
+ call VerifyScreenDump(buf, 'Test_popupwin_scroll_13', {})
+
" clean up
call term_sendkeys(buf, "x")
call StopVimInTerminal(buf)
diff --git a/src/version.c b/src/version.c
index 9e51afe330..0d8e1756f0 100644
--- a/src/version.c
+++ b/src/version.c
@@ -735,6 +735,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 5040,
+/**/
5039,
/**/
5038,