Mercurial > vim
comparison 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 |
comparison
equal
deleted
inserted
replaced
29035:02242c8534a6 | 29036:71b766ba26a6 |
---|---|
4085 // Compute scrollbar thumb position and size. | 4085 // Compute scrollbar thumb position and size. |
4086 if (wp->w_has_scrollbar) | 4086 if (wp->w_has_scrollbar) |
4087 { | 4087 { |
4088 linenr_T linecount = wp->w_buffer->b_ml.ml_line_count; | 4088 linenr_T linecount = wp->w_buffer->b_ml.ml_line_count; |
4089 int height = wp->w_height; | 4089 int height = wp->w_height; |
4090 int last; | |
4090 | 4091 |
4091 sb_thumb_height = ((linenr_T)height * height + linecount / 2) | 4092 sb_thumb_height = ((linenr_T)height * height + linecount / 2) |
4092 / linecount; | 4093 / linecount; |
4093 if (wp->w_topline > 1 && sb_thumb_height == height) | 4094 if (wp->w_topline > 1 && sb_thumb_height == height) |
4094 --sb_thumb_height; // scrolled, no full thumb | 4095 --sb_thumb_height; // scrolled, no full thumb |
4102 + (linecount / wp->w_height) / 2) | 4103 + (linecount / wp->w_height) / 2) |
4103 * (wp->w_height - sb_thumb_height) | 4104 * (wp->w_height - sb_thumb_height) |
4104 / (linecount - wp->w_height); | 4105 / (linecount - wp->w_height); |
4105 if (wp->w_topline > 1 && sb_thumb_top == 0 && height > 1) | 4106 if (wp->w_topline > 1 && sb_thumb_top == 0 && height > 1) |
4106 sb_thumb_top = 1; // show it's scrolled | 4107 sb_thumb_top = 1; // show it's scrolled |
4108 last = total_height - top_off - wp->w_popup_border[2]; | |
4109 if (sb_thumb_top >= last) | |
4110 // show at least one character | |
4111 sb_thumb_top = last; | |
4107 | 4112 |
4108 if (wp->w_scrollbar_highlight != NULL) | 4113 if (wp->w_scrollbar_highlight != NULL) |
4109 attr_scroll = syn_name2attr(wp->w_scrollbar_highlight); | 4114 attr_scroll = syn_name2attr(wp->w_scrollbar_highlight); |
4110 else | 4115 else |
4111 attr_scroll = highlight_attr[HLF_PSB]; | 4116 attr_scroll = highlight_attr[HLF_PSB]; |