mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
patch 8.1.1518: crash when setting 'columns' while a popup is visible
Problem: Crash when setting 'columns' while a popup is visible. Solution: Recompute all positions when clearing the screen. (closes #4467)
This commit is contained in:
parent
12ee7ff00b
commit
202d982b36
12
src/screen.c
12
src/screen.c
@ -1029,9 +1029,16 @@ may_update_popup_mask(int type)
|
|||||||
win_T *wp;
|
win_T *wp;
|
||||||
short *mask;
|
short *mask;
|
||||||
int line, col;
|
int line, col;
|
||||||
|
int redraw_all = FALSE;
|
||||||
|
|
||||||
if (popup_mask_tab != curtab)
|
// Need to recompute when switching tabs.
|
||||||
|
// Also recompute when the type is CLEAR or NOT_VALID, something basic
|
||||||
|
// (such as the screen size) must have changed.
|
||||||
|
if (popup_mask_tab != curtab || type >= NOT_VALID)
|
||||||
|
{
|
||||||
popup_mask_refresh = TRUE;
|
popup_mask_refresh = TRUE;
|
||||||
|
redraw_all = TRUE;
|
||||||
|
}
|
||||||
if (!popup_mask_refresh)
|
if (!popup_mask_refresh)
|
||||||
{
|
{
|
||||||
// Check if any buffer has changed.
|
// Check if any buffer has changed.
|
||||||
@ -1070,7 +1077,8 @@ may_update_popup_mask(int type)
|
|||||||
popup_visible = TRUE;
|
popup_visible = TRUE;
|
||||||
|
|
||||||
// Recompute the position if the text changed.
|
// Recompute the position if the text changed.
|
||||||
if (wp->w_popup_last_changedtick != CHANGEDTICK(wp->w_buffer))
|
if (redraw_all
|
||||||
|
|| wp->w_popup_last_changedtick != CHANGEDTICK(wp->w_buffer))
|
||||||
popup_adjust_position(wp);
|
popup_adjust_position(wp);
|
||||||
|
|
||||||
// the width and height are for the inside, add the padding and
|
// the width and height are for the inside, add the padding and
|
||||||
|
10
src/testdir/dumps/Test_popupwin_04a.dump
Normal file
10
src/testdir/dumps/Test_popupwin_04a.dump
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
> +0&#ffffff0@11
|
||||||
|
|~+0#4040ff13&| @10
|
||||||
|
|~| @10
|
||||||
|
|~| @6|o+0#0000001#ffd7ff255|t|h|e
|
||||||
|
|~+0#4040ff13#ffffff0| @6|r+0#0000001#ffd7ff255| |t|a
|
||||||
|
|~+0#4040ff13#ffffff0| @6|b+0#0000001#ffd7ff255| @2
|
||||||
|
|~+0#4040ff13#ffffff0| @6|a+0#0000001#ffd7ff255| |c+0#ff404010&|o
|
||||||
|
|~+0#4040ff13#ffffff0| @6|m+0#ff404010#ffd7ff255@1|e|n
|
||||||
|
|~+0#4040ff13#ffffff0| @6|t+0#ff404010#ffd7ff255| +0#0000001&|l|i
|
||||||
|
| +0#0000000#ffffff0@5|0|,|n+0#0000001#ffd7ff255|e| @1
|
@ -41,6 +41,12 @@ func Test_simple_popup()
|
|||||||
call term_sendkeys(buf, ":quit!\<CR>")
|
call term_sendkeys(buf, ":quit!\<CR>")
|
||||||
call VerifyScreenDump(buf, 'Test_popupwin_04', {})
|
call VerifyScreenDump(buf, 'Test_popupwin_04', {})
|
||||||
|
|
||||||
|
" set 'columns' to a small value, size must be recomputed
|
||||||
|
call term_sendkeys(buf, ":let cols = &columns\<CR>")
|
||||||
|
call term_sendkeys(buf, ":set columns=12\<CR>")
|
||||||
|
call VerifyScreenDump(buf, 'Test_popupwin_04a', {})
|
||||||
|
call term_sendkeys(buf, ":let &columns = cols\<CR>")
|
||||||
|
|
||||||
" resize popup, show empty line at bottom
|
" resize popup, show empty line at bottom
|
||||||
call term_sendkeys(buf, ":call popup_move(popupwin, {'minwidth': 15, 'maxwidth': 25, 'minheight': 3, 'maxheight': 5})\<CR>")
|
call term_sendkeys(buf, ":call popup_move(popupwin, {'minwidth': 15, 'maxwidth': 25, 'minheight': 3, 'maxheight': 5})\<CR>")
|
||||||
call term_sendkeys(buf, ":redraw\<CR>")
|
call term_sendkeys(buf, ":redraw\<CR>")
|
||||||
|
@ -777,6 +777,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 */
|
||||||
|
/**/
|
||||||
|
1518,
|
||||||
/**/
|
/**/
|
||||||
1517,
|
1517,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user