{
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;
/ (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);
--- /dev/null
+>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|
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,
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>
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)