To: vim_dev@googlegroups.com Subject: Patch 8.2.1239 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.1239 Problem: "maxwidth" in 'completepopup' not obeyed. (Jay Sitter) Solution: Add separate field for value from option. (closes #6470) Files: src/structs.h, src/popupwin.c, src/popupmenu.c, src/testdir/dumps/Test_popupwin_infopopup_9.dump *** ../vim-8.2.1238/src/structs.h 2020-07-14 15:47:18.220873671 +0200 --- src/structs.h 2020-07-18 21:13:09.545951281 +0200 *************** *** 3302,3307 **** --- 3302,3308 ---- int w_minwidth; // "minwidth" for popup window int w_maxheight; // "maxheight" 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_wantcol; // "col" for popup window int w_firstline; // "firstline" for popup window *** ../vim-8.2.1238/src/popupwin.c 2020-07-18 16:07:02.005864389 +0200 --- src/popupwin.c 2020-07-18 21:14:57.729492164 +0200 *************** *** 1620,1625 **** --- 1620,1626 ---- if (is_preview) wp->w_minwidth = x; wp->w_maxwidth = x; + wp->w_maxwidth_opt = x; } } else if (STRNCMP(s, "highlight:", 10) == 0) *** ../vim-8.2.1238/src/popupmenu.c 2020-05-30 20:30:42.896816552 +0200 --- src/popupmenu.c 2020-07-18 21:24:14.651131364 +0200 *************** *** 642,647 **** --- 642,648 ---- 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,659 **** --- 655,666 ---- 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,679 **** row += pum_selected - pum_first + 1; wp->w_popup_flags &= ~POPF_HIDDEN; ! if (wp->w_maxwidth < 10) // The popup is not going to fit or will overlap with the cursor // position, hide the popup. wp->w_popup_flags |= POPF_HIDDEN; --- 680,686 ---- row += pum_selected - pum_first + 1; wp->w_popup_flags &= ~POPF_HIDDEN; ! 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; *** ../vim-8.2.1238/src/testdir/dumps/Test_popupwin_infopopup_9.dump 2020-07-18 21:40:11.424582117 +0200 --- src/testdir/dumps/Test_popupwin_infopopup_9.dump 2020-07-18 21:34:30.452524225 +0200 *************** *** 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 *** ../vim-8.2.1238/src/version.c 2020-07-18 18:12:57.758647551 +0200 --- src/version.c 2020-07-18 21:14:17.189664183 +0200 *************** *** 756,757 **** --- 756,759 ---- { /* Add new patch number below this line */ + /**/ + 1239, /**/ -- On the other hand, you have different fingers. -- Steven Wright /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///