summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-11-21 12:42:09 +0100
committerBram Moolenaar <Bram@vim.org>2020-11-21 12:42:09 +0100
commitd91467f830236ae35eb4108d329a1e26a3f1ebc6 (patch)
treecbe55a471f51b515af5fde3a6096eae3eee618cf
parentc71ee829efa948eefec3b8f0dbacf172fc1a4992 (diff)
patch 8.2.2024: flicker when redrawing a popup with a title and borderv8.2.2024
Problem: Flicker when redrawing a popup with a title and border. Solution: Do not redraw the border where the title is displayed. (Naruhiko Nishino, closes #7334)
-rw-r--r--src/popupwin.c78
-rw-r--r--src/version.c2
2 files changed, 57 insertions, 23 deletions
diff --git a/src/popupwin.c b/src/popupwin.c
index 90b107eb5c..61f447ded2 100644
--- a/src/popupwin.c
+++ b/src/popupwin.c
@@ -3692,7 +3692,7 @@ update_popups(void (*win_update)(win_T *wp))
int row;
int wincol;
int padcol = 0;
- int padwidth = 0;
+ int padendcol = 0;
int i;
int sb_thumb_top = 0;
int sb_thumb_height = 0;
@@ -3705,6 +3705,9 @@ update_popups(void (*win_update)(win_T *wp))
popup_reset_handled(POPUP_HANDLED_5);
while ((wp = find_next_popup(TRUE, POPUP_HANDLED_5)) != NULL)
{
+ int title_len = 0;
+ int title_wincol;
+
// This drawing uses the zindex of the popup window, so that it's on
// top of the text but doesn't draw when another popup with higher
// zindex is on top of the character.
@@ -3798,16 +3801,47 @@ update_popups(void (*win_update)(win_T *wp))
border_attr[i] = syn_name2attr(wp->w_border_highlight[i]);
}
+ // Title goes on top of border or padding.
+ title_wincol = wp->w_wincol + 1;
+ if (wp->w_popup_title != NULL)
+ {
+ char_u *title_text;
+
+ title_len = (int)STRLEN(wp->w_popup_title);
+ title_text = alloc(title_len + 1);
+ trunc_string(wp->w_popup_title, title_text,
+ total_width - 2, title_len + 1);
+ screen_puts(title_text, wp->w_winrow, title_wincol,
+ wp->w_popup_border[0] > 0 ? border_attr[0] : popup_attr);
+ vim_free(title_text);
+ if (title_len > total_width - 2)
+ title_len = total_width - 2;
+ }
+
wincol = wp->w_wincol - wp->w_popup_leftoff;
top_padding = wp->w_popup_padding[0];
if (wp->w_popup_border[0] > 0)
{
- // top border
- screen_fill(wp->w_winrow, wp->w_winrow + 1,
- wincol < 0 ? 0 : wincol, wincol + total_width,
- wp->w_popup_border[3] != 0 && wp->w_popup_leftoff == 0
+ // top border; do not draw over the title
+ if (title_len > 0)
+ {
+ screen_fill(wp->w_winrow, wp->w_winrow + 1,
+ wincol < 0 ? 0 : wincol, title_wincol,
+ wp->w_popup_border[3] != 0 && wp->w_popup_leftoff == 0
+ ? border_char[4] : border_char[0],
+ border_char[0], border_attr[0]);
+ screen_fill(wp->w_winrow, wp->w_winrow + 1,
+ title_wincol + title_len, wincol + total_width,
+ border_char[0], border_char[0], border_attr[0]);
+ }
+ else
+ {
+ screen_fill(wp->w_winrow, wp->w_winrow + 1,
+ wincol < 0 ? 0 : wincol, wincol + total_width,
+ wp->w_popup_border[3] != 0 && wp->w_popup_leftoff == 0
? border_char[4] : border_char[0],
- border_char[0], border_attr[0]);
+ border_char[0], border_attr[0]);
+ }
if (wp->w_popup_border[1] > 0 && wp->w_popup_rightoff == 0)
{
buf[mb_char2bytes(border_char[5], buf)] = NUL;
@@ -3821,32 +3855,30 @@ update_popups(void (*win_update)(win_T *wp))
if (top_padding > 0 || wp->w_popup_padding[2] > 0)
{
padcol = wincol + wp->w_popup_border[3];
- padwidth = wp->w_wincol + total_width - wp->w_popup_border[1]
+ padendcol = wp->w_wincol + total_width - wp->w_popup_border[1]
- wp->w_has_scrollbar;
if (padcol < 0)
{
- padwidth += padcol;
+ padendcol += padcol;
padcol = 0;
}
}
if (top_padding > 0)
{
- // top padding
+ // top padding; do not draw over the title
row = wp->w_winrow + wp->w_popup_border[0];
- screen_fill(row, row + top_padding, padcol, padwidth,
+ if (title_len > 0)
+ {
+ screen_fill(row, row + top_padding, padcol, title_wincol,
' ', ' ', popup_attr);
- }
-
- // Title goes on top of border or padding.
- if (wp->w_popup_title != NULL)
- {
- int len = (int)STRLEN(wp->w_popup_title) + 1;
- char_u *title = alloc(len);
-
- trunc_string(wp->w_popup_title, title, total_width - 2, len);
- screen_puts(title, wp->w_winrow, wp->w_wincol + 1,
- wp->w_popup_border[0] > 0 ? border_attr[0] : popup_attr);
- vim_free(title);
+ screen_fill(row, row + top_padding, title_wincol + title_len,
+ padendcol, ' ', ' ', popup_attr);
+ }
+ else
+ {
+ screen_fill(row, row + top_padding, padcol, padendcol,
+ ' ', ' ', popup_attr);
+ }
}
// Compute scrollbar thumb position and size.
@@ -3948,7 +3980,7 @@ update_popups(void (*win_update)(win_T *wp))
row = wp->w_winrow + wp->w_popup_border[0]
+ wp->w_popup_padding[0] + wp->w_height;
screen_fill(row, row + wp->w_popup_padding[2],
- padcol, padwidth, ' ', ' ', popup_attr);
+ padcol, padendcol, ' ', ' ', popup_attr);
}
if (wp->w_popup_border[2] > 0)
diff --git a/src/version.c b/src/version.c
index 5996bd67fd..ca29e34d21 100644
--- a/src/version.c
+++ b/src/version.c
@@ -751,6 +751,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 2024,
+/**/
2023,
/**/
2022,