mirror of
https://github.com/vim/vim.git
synced 2025-09-23 03:43:49 -04:00
patch 8.2.1239: "maxwidth" in 'completepopup' not obeyed
Problem: "maxwidth" in 'completepopup' not obeyed. (Jay Sitter) Solution: Add separate field for value from option. (closes #6470)
This commit is contained in:
@@ -642,6 +642,7 @@ pum_position_info_popup(win_T *wp)
|
|||||||
int col = pum_col + pum_width + pum_scrollbar + 1;
|
int col = pum_col + pum_width + pum_scrollbar + 1;
|
||||||
int row = pum_row;
|
int row = pum_row;
|
||||||
int botpos = POPPOS_BOTLEFT;
|
int botpos = POPPOS_BOTLEFT;
|
||||||
|
int used_maxwidth_opt = FALSE;
|
||||||
|
|
||||||
wp->w_popup_pos = POPPOS_TOPLEFT;
|
wp->w_popup_pos = POPPOS_TOPLEFT;
|
||||||
if (Columns - col < 20 && Columns - col < pum_col)
|
if (Columns - col < 20 && Columns - col < pum_col)
|
||||||
@@ -654,6 +655,12 @@ pum_position_info_popup(win_T *wp)
|
|||||||
else
|
else
|
||||||
wp->w_maxwidth = Columns - col + 1;
|
wp->w_maxwidth = Columns - col + 1;
|
||||||
wp->w_maxwidth -= popup_extra_width(wp);
|
wp->w_maxwidth -= popup_extra_width(wp);
|
||||||
|
if (wp->w_maxwidth_opt > 0 && wp->w_maxwidth > wp->w_maxwidth_opt)
|
||||||
|
{
|
||||||
|
// option value overrules computed value
|
||||||
|
wp->w_maxwidth = wp->w_maxwidth_opt;
|
||||||
|
used_maxwidth_opt = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
row -= popup_top_extra(wp);
|
row -= popup_top_extra(wp);
|
||||||
if (wp->w_popup_flags & POPF_INFO_MENU)
|
if (wp->w_popup_flags & POPF_INFO_MENU)
|
||||||
@@ -673,7 +680,7 @@ pum_position_info_popup(win_T *wp)
|
|||||||
row += pum_selected - pum_first + 1;
|
row += pum_selected - pum_first + 1;
|
||||||
|
|
||||||
wp->w_popup_flags &= ~POPF_HIDDEN;
|
wp->w_popup_flags &= ~POPF_HIDDEN;
|
||||||
if (wp->w_maxwidth < 10)
|
if (wp->w_maxwidth < 10 && !used_maxwidth_opt)
|
||||||
// The popup is not going to fit or will overlap with the cursor
|
// The popup is not going to fit or will overlap with the cursor
|
||||||
// position, hide the popup.
|
// position, hide the popup.
|
||||||
wp->w_popup_flags |= POPF_HIDDEN;
|
wp->w_popup_flags |= POPF_HIDDEN;
|
||||||
|
@@ -1620,6 +1620,7 @@ parse_popup_option(win_T *wp, int is_preview)
|
|||||||
if (is_preview)
|
if (is_preview)
|
||||||
wp->w_minwidth = x;
|
wp->w_minwidth = x;
|
||||||
wp->w_maxwidth = x;
|
wp->w_maxwidth = x;
|
||||||
|
wp->w_maxwidth_opt = x;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (STRNCMP(s, "highlight:", 10) == 0)
|
else if (STRNCMP(s, "highlight:", 10) == 0)
|
||||||
|
@@ -3302,6 +3302,7 @@ struct window_S
|
|||||||
int w_minwidth; // "minwidth" for popup window
|
int w_minwidth; // "minwidth" for popup window
|
||||||
int w_maxheight; // "maxheight" for popup window
|
int w_maxheight; // "maxheight" for popup window
|
||||||
int w_maxwidth; // "maxwidth" for popup window
|
int w_maxwidth; // "maxwidth" for popup window
|
||||||
|
int w_maxwidth_opt; // maxwidth from option
|
||||||
int w_wantline; // "line" for popup window
|
int w_wantline; // "line" for popup window
|
||||||
int w_wantcol; // "col" for popup window
|
int w_wantcol; // "col" for popup window
|
||||||
int w_firstline; // "firstline" for popup window
|
int w_firstline; // "firstline" for popup window
|
||||||
|
14
src/testdir/dumps/Test_popupwin_infopopup_9.dump
Normal file
14
src/testdir/dumps/Test_popupwin_infopopup_9.dump
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
|a+0&#ffffff0|w|o|r|d| @69
|
||||||
|
|t|e|s|a|w|o|r|d> @66
|
||||||
|
|~+0#4040ff13&| | +0#0000001#e0e0e08|w|r|d| @4|W| |e|x|t|r|a| |t|e|x|t| @1| +0#0000000#0000001| +0#0000001#e0e0e08|w|o|r|d|s| |a|r|e| @1| +0#4040ff13#ffffff0@36
|
||||||
|
|~| | +0#0000001#ffd7ff255|a|n|o|t|w|r|d| |W| |e|x|t|r|a| |t|e|x|t| @1| +0#0000000#0000001| +0#0000001#e0e0e08|c|o@1|l| @6| +0#4040ff13#ffffff0@36
|
||||||
|
|~| | +0#0000001#ffd7ff255|n|o|a|w|r|d| @1|W| |e|x|t|r|a| |t|e|x|t| @1| +0#0000000#a8a8a8255| +0#4040ff13#ffffff0@48
|
||||||
|
|~| @73
|
||||||
|
|~| @73
|
||||||
|
|~| @73
|
||||||
|
|~| @73
|
||||||
|
|~| @73
|
||||||
|
|~| @73
|
||||||
|
|~| @73
|
||||||
|
|~| @73
|
||||||
|
|-+2#0000000&@1| |U|s|e|r| |d|e|f|i|n|e|d| |c|o|m|p|l|e|t|i|o|n| |(|^|U|^|N|^|P|)| |m+0#00e0003&|a|t|c|h| |1| |o|f| |4| +0#0000000&@26
|
@@ -754,6 +754,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 */
|
||||||
|
/**/
|
||||||
|
1239,
|
||||||
/**/
|
/**/
|
||||||
1238,
|
1238,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user