To: vim_dev@googlegroups.com Subject: Patch 8.2.5040 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.5040 Problem: Scrollbar thumb in scrolled popup not visible. Solution: Show at least one thumb character. (fixes 10492) Files: src/popupwin.c, src/testdir/test_popupwin.vim, src/testdir/dumps/Test_popupwin_scroll_13.dump *** ../vim-8.2.5039/src/popupwin.c 2022-05-29 17:13:15.779819248 +0100 --- src/popupwin.c 2022-05-29 18:13:19.030816149 +0100 *************** *** 4087,4092 **** --- 4087,4093 ---- { 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,4109 **** --- 4105,4114 ---- / (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); *** ../vim-8.2.5039/src/testdir/test_popupwin.vim 2022-05-29 17:13:15.779819248 +0100 --- src/testdir/test_popupwin.vim 2022-05-29 18:07:37.371463096 +0100 *************** *** 2314,2321 **** endif endfunc ! def CreatePopup(text: list) ! popup_create(text, { \ minwidth: 30, \ maxwidth: 30, \ minheight: 4, --- 2314,2321 ---- endif endfunc ! def CreatePopup(text: list): number ! return popup_create(text, { \ minwidth: 30, \ maxwidth: 30, \ minheight: 4, *************** *** 2342,2347 **** --- 2342,2352 ---- 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 :call test_setmouse(5, 36) map :call test_setmouse(4, 42) map :call test_setmouse(7, 42) *************** *** 2397,2402 **** --- 2402,2411 ---- 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()\") + call VerifyScreenDump(buf, 'Test_popupwin_scroll_13', {}) + " clean up call term_sendkeys(buf, "x") call StopVimInTerminal(buf) *** ../vim-8.2.5039/src/testdir/dumps/Test_popupwin_scroll_13.dump 2022-05-29 18:11:07.179050094 +0100 --- src/testdir/dumps/Test_popupwin_scroll_13.dump 2022-05-29 18:07:49.723437072 +0100 *************** *** 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| *** ../vim-8.2.5039/src/version.c 2022-05-29 17:13:15.779819248 +0100 --- src/version.c 2022-05-29 17:37:38.054897951 +0100 *************** *** 736,737 **** --- 736,739 ---- { /* Add new patch number below this line */ + /**/ + 5040, /**/ -- GUARD #1: What -- a swallow carrying a coconut? ARTHUR: It could grip it by the husk! GUARD #1: It's not a question of where he grips it! It's a simple question of weight ratios! A five ounce bird could not carry a 1 pound coconut. The Quest for the Holy Grail (Monty Python) /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///