diff src/popupwin.c @ 29036:71b766ba26a6 v8.2.5040

patch 8.2.5040: scrollbar thumb in scrolled popup not visible Commit: https://github.com/vim/vim/commit/fc376e0b1a36a2ef153e28752c61342554386886 Author: Bram Moolenaar <Bram@vim.org> Date: Sun May 29 18:18:18 2022 +0100 patch 8.2.5040: scrollbar thumb in scrolled popup not visible Problem: Scrollbar thumb in scrolled popup not visible. Solution: Show at least one thumb character. (fixes 10492)
author Bram Moolenaar <Bram@vim.org>
date Sun, 29 May 2022 19:30:02 +0200
parents f3c014fe5c16
children 5d71ed834c03
line wrap: on
line diff
--- a/src/popupwin.c
+++ b/src/popupwin.c
@@ -4087,6 +4087,7 @@ update_popups(void (*win_update)(win_T *
 	{
 	    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 *
 						  / (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);