forked from aniani/vim
patch 8.2.2024: flicker when redrawing a popup with a title and border
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)
This commit is contained in:
@@ -3692,7 +3692,7 @@ update_popups(void (*win_update)(win_T *wp))
|
|||||||
int row;
|
int row;
|
||||||
int wincol;
|
int wincol;
|
||||||
int padcol = 0;
|
int padcol = 0;
|
||||||
int padwidth = 0;
|
int padendcol = 0;
|
||||||
int i;
|
int i;
|
||||||
int sb_thumb_top = 0;
|
int sb_thumb_top = 0;
|
||||||
int sb_thumb_height = 0;
|
int sb_thumb_height = 0;
|
||||||
@@ -3705,6 +3705,9 @@ update_popups(void (*win_update)(win_T *wp))
|
|||||||
popup_reset_handled(POPUP_HANDLED_5);
|
popup_reset_handled(POPUP_HANDLED_5);
|
||||||
while ((wp = find_next_popup(TRUE, POPUP_HANDLED_5)) != NULL)
|
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
|
// 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
|
// top of the text but doesn't draw when another popup with higher
|
||||||
// zindex is on top of the character.
|
// 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]);
|
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;
|
wincol = wp->w_wincol - wp->w_popup_leftoff;
|
||||||
top_padding = wp->w_popup_padding[0];
|
top_padding = wp->w_popup_padding[0];
|
||||||
if (wp->w_popup_border[0] > 0)
|
if (wp->w_popup_border[0] > 0)
|
||||||
{
|
{
|
||||||
// top border
|
// 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,
|
screen_fill(wp->w_winrow, wp->w_winrow + 1,
|
||||||
wincol < 0 ? 0 : wincol, wincol + total_width,
|
wincol < 0 ? 0 : wincol, wincol + total_width,
|
||||||
wp->w_popup_border[3] != 0 && wp->w_popup_leftoff == 0
|
wp->w_popup_border[3] != 0 && wp->w_popup_leftoff == 0
|
||||||
? border_char[4] : border_char[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)
|
if (wp->w_popup_border[1] > 0 && wp->w_popup_rightoff == 0)
|
||||||
{
|
{
|
||||||
buf[mb_char2bytes(border_char[5], buf)] = NUL;
|
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)
|
if (top_padding > 0 || wp->w_popup_padding[2] > 0)
|
||||||
{
|
{
|
||||||
padcol = wincol + wp->w_popup_border[3];
|
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;
|
- wp->w_has_scrollbar;
|
||||||
if (padcol < 0)
|
if (padcol < 0)
|
||||||
{
|
{
|
||||||
padwidth += padcol;
|
padendcol += padcol;
|
||||||
padcol = 0;
|
padcol = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (top_padding > 0)
|
if (top_padding > 0)
|
||||||
{
|
{
|
||||||
// top padding
|
// top padding; do not draw over the title
|
||||||
row = wp->w_winrow + wp->w_popup_border[0];
|
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);
|
||||||
|
screen_fill(row, row + top_padding, title_wincol + title_len,
|
||||||
|
padendcol, ' ', ' ', popup_attr);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
screen_fill(row, row + top_padding, padcol, padendcol,
|
||||||
' ', ' ', popup_attr);
|
' ', ' ', 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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compute scrollbar thumb position and size.
|
// 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]
|
row = wp->w_winrow + wp->w_popup_border[0]
|
||||||
+ wp->w_popup_padding[0] + wp->w_height;
|
+ wp->w_popup_padding[0] + wp->w_height;
|
||||||
screen_fill(row, row + wp->w_popup_padding[2],
|
screen_fill(row, row + wp->w_popup_padding[2],
|
||||||
padcol, padwidth, ' ', ' ', popup_attr);
|
padcol, padendcol, ' ', ' ', popup_attr);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wp->w_popup_border[2] > 0)
|
if (wp->w_popup_border[2] > 0)
|
||||||
|
@@ -750,6 +750,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
2024,
|
||||||
/**/
|
/**/
|
||||||
2023,
|
2023,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user