0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

patch 8.1.1620: no test for popup window with border and mask

Problem:    No test for popup window with border and mask.
Solution:   Add this popup window, fix problems.
This commit is contained in:
Bram Moolenaar
2019-07-03 22:50:41 +02:00
parent 435f9f06ca
commit ba45f1f4fb
7 changed files with 77 additions and 50 deletions

View File

@@ -2337,6 +2337,7 @@ update_popups(void (*win_update)(win_T *wp))
int border_char[8];
char_u buf[MB_MAXBYTES];
int row;
int wincol;
int padcol = 0;
int padwidth = 0;
int i;
@@ -2409,21 +2410,21 @@ update_popups(void (*win_update)(win_T *wp))
border_attr[i] = syn_name2attr(wp->w_border_highlight[i]);
}
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,
wp->w_wincol,
wp->w_wincol + total_width,
wp->w_popup_border[3] != 0
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]);
if (wp->w_popup_border[1] > 0)
if (wp->w_popup_border[1] > 0 && wp->w_popup_rightoff == 0)
{
buf[mb_char2bytes(border_char[5], buf)] = NUL;
screen_puts(buf, wp->w_winrow,
wp->w_wincol + total_width - 1, border_attr[1]);
wincol + total_width - 1, border_attr[1]);
}
}
else if (wp->w_popup_padding[0] == 0 && popup_top_extra(wp) > 0)
@@ -2431,7 +2432,7 @@ update_popups(void (*win_update)(win_T *wp))
if (top_padding > 0 || wp->w_popup_padding[2] > 0)
{
padcol = wp->w_wincol - wp->w_popup_leftoff + wp->w_popup_border[3];
padcol = wincol + wp->w_popup_border[3];
padwidth = wp->w_wincol + total_width - wp->w_popup_border[1]
- wp->w_has_scrollbar;
if (padcol < 0)
@@ -2479,7 +2480,6 @@ update_popups(void (*win_update)(win_T *wp))
i < total_height - wp->w_popup_border[2]; ++i)
{
int pad_left;
int col = wp->w_wincol - wp->w_popup_leftoff;
// left and right padding only needed next to the body
int do_padding =
i >= wp->w_popup_border[0] + wp->w_popup_padding[0]
@@ -2489,15 +2489,16 @@ update_popups(void (*win_update)(win_T *wp))
row = wp->w_winrow + i;
// left border
if (wp->w_popup_border[3] > 0 && col >= 0)
if (wp->w_popup_border[3] > 0 && wincol >= 0)
{
buf[mb_char2bytes(border_char[3], buf)] = NUL;
screen_puts(buf, row, col, border_attr[3]);
screen_puts(buf, row, wincol, border_attr[3]);
}
if (do_padding && wp->w_popup_padding[3] > 0)
{
int col = wincol + wp->w_popup_border[3];
// left padding
col += wp->w_popup_border[3];
pad_left = wp->w_popup_padding[3];
if (col < 0)
{
@@ -2526,14 +2527,12 @@ update_popups(void (*win_update)(win_T *wp))
if (wp->w_popup_border[1] > 0)
{
buf[mb_char2bytes(border_char[1], buf)] = NUL;
screen_puts(buf, row,
wp->w_wincol + total_width - 1, border_attr[1]);
screen_puts(buf, row, wincol + total_width - 1, border_attr[1]);
}
// right padding
if (do_padding && wp->w_popup_padding[1] > 0)
screen_puts(get_spaces(wp->w_popup_padding[1]), row,
wp->w_wincol - wp->w_popup_leftoff
+ wp->w_popup_border[3]
wincol + wp->w_popup_border[3]
+ wp->w_popup_padding[3] + wp->w_width + wp->w_leftcol,
popup_attr);
}
@@ -2552,16 +2551,15 @@ update_popups(void (*win_update)(win_T *wp))
// bottom border
row = wp->w_winrow + total_height - 1;
screen_fill(row , row + 1,
wp->w_wincol,
wp->w_wincol + total_width,
wp->w_popup_border[3] != 0
wincol < 0 ? 0 : wincol,
wincol + total_width,
wp->w_popup_border[3] != 0 && wp->w_popup_leftoff == 0
? border_char[7] : border_char[2],
border_char[2], border_attr[2]);
if (wp->w_popup_border[1] > 0)
{
buf[mb_char2bytes(border_char[6], buf)] = NUL;
screen_puts(buf, row,
wp->w_wincol + total_width - 1, border_attr[2]);
screen_puts(buf, row, wincol + total_width - 1, border_attr[2]);
}
}
@@ -2569,7 +2567,7 @@ update_popups(void (*win_update)(win_T *wp))
{
// close button goes on top of anything at the top-right corner
buf[mb_char2bytes('X', buf)] = NUL;
screen_puts(buf, wp->w_winrow, wp->w_wincol + total_width - 1,
screen_puts(buf, wp->w_winrow, wincol + total_width - 1,
wp->w_popup_border[0] > 0 ? border_attr[0] : popup_attr);
}