summaryrefslogtreecommitdiff
path: root/src/popupmenu.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-07-18 21:40:41 +0200
committerBram Moolenaar <Bram@vim.org>2020-07-18 21:40:41 +0200
commitde2396fc875837c47b1c13f5e80e0a1200c5eb61 (patch)
tree54faaa93dc859a2529e32bb0d6d41935651a9299 /src/popupmenu.c
parentd032f34a51c6722101626c4167dffecc427ac343 (diff)
downloadvim-git-de2396fc875837c47b1c13f5e80e0a1200c5eb61.tar.gz
patch 8.2.1239: "maxwidth" in 'completepopup' not obeyedv8.2.1239
Problem: "maxwidth" in 'completepopup' not obeyed. (Jay Sitter) Solution: Add separate field for value from option. (closes #6470)
Diffstat (limited to 'src/popupmenu.c')
-rw-r--r--src/popupmenu.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/popupmenu.c b/src/popupmenu.c
index 197cdca76..279a68d7a 100644
--- a/src/popupmenu.c
+++ b/src/popupmenu.c
@@ -642,6 +642,7 @@ pum_position_info_popup(win_T *wp)
int col = pum_col + pum_width + pum_scrollbar + 1;
int row = pum_row;
int botpos = POPPOS_BOTLEFT;
+ int used_maxwidth_opt = FALSE;
wp->w_popup_pos = POPPOS_TOPLEFT;
if (Columns - col < 20 && Columns - col < pum_col)
@@ -654,6 +655,12 @@ pum_position_info_popup(win_T *wp)
else
wp->w_maxwidth = Columns - col + 1;
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);
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;
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
// position, hide the popup.
wp->w_popup_flags |= POPF_HIDDEN;