# HG changeset patch # User Bram Moolenaar # Date 1648910703 -7200 # Node ID 8ef5c996df3126541f9d3426bbddb646eb86d8fa # Parent c943820b9c01ffd09427f518d9bc08a023256e2e patch 8.2.4665: popup with "minwidth" and scrollbar not updated properly Commit: https://github.com/vim/vim/commit/eabddc425ea23fb91b3b0058ff01e9e4ede53351 Author: Bram Moolenaar Date: Sat Apr 2 15:32:16 2022 +0100 patch 8.2.4665: popup with "minwidth" and scrollbar not updated properly Problem: Popup with "minwidth" and scrollbar not updated properly. Solution: Adjust the computation if the window width. (closes https://github.com/vim/vim/issues/10061) diff --git a/src/popupwin.c b/src/popupwin.c --- a/src/popupwin.c +++ b/src/popupwin.c @@ -1149,6 +1149,8 @@ popup_adjust_position(win_T *wp) linenr_T lnum; int wrapped = 0; int maxwidth; + int maxwidth_no_scrollbar; + int width_with_scrollbar = 0; int used_maxwidth = FALSE; int margin_width = 0; int maxspace; @@ -1421,6 +1423,7 @@ popup_adjust_position(win_T *wp) // Terminal window never has a scrollbar, adjusts to window height. wp->w_has_scrollbar = FALSE; #endif + maxwidth_no_scrollbar = maxwidth; if (wp->w_has_scrollbar) { ++right_extra; @@ -1447,7 +1450,27 @@ popup_adjust_position(win_T *wp) if (wp->w_width > maxspace && !wp->w_p_wrap) // some columns cut off on the right wp->w_popup_rightoff = wp->w_width - maxspace; - wp->w_width = maxwidth; + + // If the window doesn't fit because 'minwidth' is set then the + // scrollbar is at the far right of the screen, use the size without + // the scrollbar. + if (wp->w_has_scrollbar && wp->w_minwidth > 0) + { + int off = wp->w_width - maxwidth; + + if (off > right_extra) + extra_width -= right_extra; + else + extra_width -= off; + wp->w_width = maxwidth_no_scrollbar; + } + else + { + wp->w_width = maxwidth; + + // when adding a scrollbar below need to adjust the width + width_with_scrollbar = maxwidth_no_scrollbar - right_extra; + } } if (center_hor) { @@ -1535,7 +1558,8 @@ popup_adjust_position(win_T *wp) else if (wp->w_popup_pos == POPPOS_TOPRIGHT || wp->w_popup_pos == POPPOS_TOPLEFT) { - if (wantline + (wp->w_height + extra_height) - 1 > Rows + if (wp != popup_dragwin + && wantline + (wp->w_height + extra_height) - 1 > Rows && wantline * 2 > Rows && (wp->w_popup_flags & POPF_POSINVERT)) { @@ -1565,7 +1589,11 @@ popup_adjust_position(win_T *wp) #ifdef FEAT_TERMINAL if (wp->w_buffer->b_term == NULL) #endif + { wp->w_has_scrollbar = TRUE; + if (width_with_scrollbar > 0) + wp->w_width = width_with_scrollbar; + } } // make sure w_winrow is valid @@ -3894,7 +3922,7 @@ update_popups(void (*win_update)(win_T * wp->w_flags |= WFLAG_WROW_OFF_ADDED; } - total_width = popup_width(wp); + total_width = popup_width(wp) - wp->w_popup_rightoff; total_height = popup_height(wp); popup_attr = get_wcr_attr(wp); @@ -3989,7 +4017,7 @@ update_popups(void (*win_update)(win_T * ? border_char[4] : border_char[0], border_char[0], border_attr[0]); } - if (wp->w_popup_border[1] > 0 && wp->w_popup_rightoff == 0) + if (wp->w_popup_border[1] > 0) { buf[mb_char2bytes(border_char[5], buf)] = NUL; screen_puts(buf, wp->w_winrow, @@ -4039,7 +4067,7 @@ update_popups(void (*win_update)(win_T * --sb_thumb_height; // scrolled, no full thumb if (sb_thumb_height == 0) sb_thumb_height = 1; - if (linecount <= wp->w_height) + if (linecount <= wp->w_height || wp->w_height == 0) // it just fits, avoid divide by zero sb_thumb_top = 0; else diff --git a/src/testdir/dumps/Test_popupwin_drag_minwidth_1.dump b/src/testdir/dumps/Test_popupwin_drag_minwidth_1.dump new file mode 100644 --- /dev/null +++ b/src/testdir/dumps/Test_popupwin_drag_minwidth_1.dump @@ -0,0 +1,10 @@ +>╔+0#0000001#ffd7ff255|═@73 +|║|0| @72 +|║|1| @72 +|║|2| @72 +|║|3| @72 +|║|4| @72 +|║|5| @72 +|║|6| @72 +|║|7| @72 +|║|8| @72 diff --git a/src/testdir/dumps/Test_popupwin_drag_minwidth_2.dump b/src/testdir/dumps/Test_popupwin_drag_minwidth_2.dump new file mode 100644 --- /dev/null +++ b/src/testdir/dumps/Test_popupwin_drag_minwidth_2.dump @@ -0,0 +1,10 @@ +> +0&#ffffff0@74 +|~+0#4040ff13&| @73 +|~| @73 +|~| @73 +|~| @26|╔+0#0000001#ffd7ff255|═@44|╗ +|~+0#4040ff13#ffffff0| @26|║+0#0000001#ffd7ff255|0| @42| +0#0000000#0000001|║+0#0000001#ffd7ff255 +|~+0#4040ff13#ffffff0| @26|║+0#0000001#ffd7ff255|1| @42| +0#0000000#a8a8a8255|║+0#0000001#ffd7ff255 +|~+0#4040ff13#ffffff0| @26|║+0#0000001#ffd7ff255|2| @42| +0#0000000#a8a8a8255|║+0#0000001#ffd7ff255 +|~+0#4040ff13#ffffff0| @26|║+0#0000001#ffd7ff255|3| @42| +0#0000000#a8a8a8255|║+0#0000001#ffd7ff255 +| +0#0000000#ffffff0@27|╚+0#0000001#ffd7ff255|═@44|╝ diff --git a/src/testdir/dumps/Test_popupwin_drag_minwidth_3.dump b/src/testdir/dumps/Test_popupwin_drag_minwidth_3.dump new file mode 100644 --- /dev/null +++ b/src/testdir/dumps/Test_popupwin_drag_minwidth_3.dump @@ -0,0 +1,10 @@ +> +0&#ffffff0@74 +|~+0#4040ff13&| @73 +|~| @26|╔+0#0000001#ffd7ff255|═@44|╗ +|~+0#4040ff13#ffffff0| @26|║+0#0000001#ffd7ff255|0| @42| +0#0000000#0000001|║+0#0000001#ffd7ff255 +|~+0#4040ff13#ffffff0| @26|║+0#0000001#ffd7ff255|1| @42| +0#0000000#a8a8a8255|║+0#0000001#ffd7ff255 +|~+0#4040ff13#ffffff0| @26|║+0#0000001#ffd7ff255|2| @42| +0#0000000#a8a8a8255|║+0#0000001#ffd7ff255 +|~+0#4040ff13#ffffff0| @26|║+0#0000001#ffd7ff255|3| @42| +0#0000000#a8a8a8255|║+0#0000001#ffd7ff255 +|~+0#4040ff13#ffffff0| @26|║+0#0000001#ffd7ff255|4| @42| +0#0000000#a8a8a8255|║+0#0000001#ffd7ff255 +|~+0#4040ff13#ffffff0| @26|║+0#0000001#ffd7ff255|5| @42| +0#0000000#a8a8a8255|║+0#0000001#ffd7ff255 +| +0#0000000#ffffff0@27|╚+0#0000001#ffd7ff255|═@44|╝ diff --git a/src/testdir/dumps/Test_popupwin_previewpopup_10.dump b/src/testdir/dumps/Test_popupwin_previewpopup_10.dump --- a/src/testdir/dumps/Test_popupwin_previewpopup_10.dump +++ b/src/testdir/dumps/Test_popupwin_previewpopup_10.dump @@ -2,12 +2,12 @@ |#|i|n|c|l|u|d|e| |"|X|h|e|a|d|e|r|.|h|"| @54 |t|h|r|e@1| @69 |f|o|u|r| @70 -|f|i|v|e| @28|╔+0#0000001#ffd7ff255| |X|h|e|a|d|e|r|.|h| |═@28|X -|s+0#0000000#ffffff0|i|x| @29|║+0#0000001#ffd7ff255|1+0#e000002&|0| +0#0000001&@36| +0#0000000#a8a8a8255|║+0#0000001#ffd7ff255 -|s+0#0000000#ffffff0|e|v|e|n| @27|║+0#0000001#ffd7ff255|s|e|a|r|c|h|e|d| |w|o|r|d| |i|s| |h|e|r|e| @17| +0#0000000#a8a8a8255|║+0#0000001#ffd7ff255 -|f+0#0000000#ffffff0|i|n|d| |t|h|e|w|o|r|d| |s|o|m|e|w|h|e|r|e| @10|║+0#0000001#ffd7ff255|1+0#e000002&|2| +0#0000001&@36| +0#0000000#0000001|║+0#0000001#ffd7ff255 -|n+0#0000000#ffffff0|i|n|e| @28|║+0#0000001#ffd7ff255|1+0#e000002&|3| +0#0000001&@36| +0#0000000#a8a8a8255|║+0#0000001#ffd7ff255 -|t+0#0000000#ffffff0|h|i|s| |i|s| |a|n|o|t|h|e|r| |w|o|r|d| @12|╚+0#0000001#ffd7ff255|═@39|⇲ +|f|i|v|e| @27|╔+0#0000001#ffd7ff255| |X|h|e|a|d|e|r|.|h| |═@29|X +|s+0#0000000#ffffff0|i|x| @28|║+0#0000001#ffd7ff255|1+0#e000002&|0| +0#0000001&@37| +0#0000000#a8a8a8255|║+0#0000001#ffd7ff255 +|s+0#0000000#ffffff0|e|v|e|n| @26|║+0#0000001#ffd7ff255|s|e|a|r|c|h|e|d| |w|o|r|d| |i|s| |h|e|r|e| @18| +0#0000000#a8a8a8255|║+0#0000001#ffd7ff255 +|f+0#0000000#ffffff0|i|n|d| |t|h|e|w|o|r|d| |s|o|m|e|w|h|e|r|e| @9|║+0#0000001#ffd7ff255|1+0#e000002&|2| +0#0000001&@37| +0#0000000#0000001|║+0#0000001#ffd7ff255 +|n+0#0000000#ffffff0|i|n|e| @27|║+0#0000001#ffd7ff255|1+0#e000002&|3| +0#0000001&@37| +0#0000000#a8a8a8255|║+0#0000001#ffd7ff255 +|t+0#0000000#ffffff0|h|i|s| |i|s| |a|n|o|t|h|e|r| |w|o|r|d| @11|╚+0#0000001#ffd7ff255|═@40|⇲ |v+0#0000000#ffffff0|e|r|y| |l|o|n|g| |l|i|n|e| |w|h|e|r|e| |t|h|e| |w|o|r|d| |i|s| |a|l|s|o| >a|n|o|t|h|e|r| @29 |~+0#4040ff13&| @73 |~| @73 diff --git a/src/testdir/dumps/Test_popupwin_previewpopup_4.dump b/src/testdir/dumps/Test_popupwin_previewpopup_4.dump --- a/src/testdir/dumps/Test_popupwin_previewpopup_4.dump +++ b/src/testdir/dumps/Test_popupwin_previewpopup_4.dump @@ -2,12 +2,12 @@ |#|i|n|c|l|u|d|e| |"|X|h|e|a|d|e|r|.|h|"| @54 |t|h|r|e@1| @69 |f|o|u|r| @70 -|f|i|v|e| @28|╔+0&#afffff255| |X|t|a|g|f|i|l|e| |═@29|X -|s+0&#ffffff0|i|x| @29|║+0&#afffff255|2|7| @36| +0&#a8a8a8255|║+0&#afffff255 -|s+0&#ffffff0|e|v|e|n| @27|║+0&#afffff255|t|h|i|s| |i|s| |a|n|o|t|h|e|r| |p|l|a|c|e| @17| +0&#a8a8a8255|║+0&#afffff255 -|f+0&#ffffff0|i|n|d| |t|h|e|w|o|r|d| |s|o|m|e|w|h|e|r|e| @10|║+0&#afffff255|2|9| @36| +0|║+0&#afffff255 -|n+0&#ffffff0|i|n|e| @28|║+0&#afffff255|3|0| @36| +0&#a8a8a8255|║+0&#afffff255 -|t+0&#ffffff0|h|i|s| |i|s| |a|n|o|t|h|e|r| |w|o|r|d| @12|╚+0&#afffff255|═@39|⇲ +|f|i|v|e| @27|╔+0&#afffff255| |X|t|a|g|f|i|l|e| |═@30|X +|s+0&#ffffff0|i|x| @28|║+0&#afffff255|2|7| @37| +0&#a8a8a8255|║+0&#afffff255 +|s+0&#ffffff0|e|v|e|n| @26|║+0&#afffff255|t|h|i|s| |i|s| |a|n|o|t|h|e|r| |p|l|a|c|e| @18| +0&#a8a8a8255|║+0&#afffff255 +|f+0&#ffffff0|i|n|d| |t|h|e|w|o|r|d| |s|o|m|e|w|h|e|r|e| @9|║+0&#afffff255|2|9| @37| +0|║+0&#afffff255 +|n+0&#ffffff0|i|n|e| @27|║+0&#afffff255|3|0| @37| +0&#a8a8a8255|║+0&#afffff255 +|t+0&#ffffff0|h|i|s| |i|s| |a|n|o|t|h|e|r| |w|o|r|d| @11|╚+0&#afffff255|═@40|⇲ |v+0&#ffffff0|e|r|y| |l|o|n|g| |l|i|n|e| |w|h|e|r|e| |t|h|e| |w|o|r|d| |i|s| |a|l|s|o| >a|n|o|t|h|e|r| @29 |~+0#4040ff13&| @73 |~| @73 diff --git a/src/testdir/dumps/Test_popupwin_previewpopup_5.dump b/src/testdir/dumps/Test_popupwin_previewpopup_5.dump --- a/src/testdir/dumps/Test_popupwin_previewpopup_5.dump +++ b/src/testdir/dumps/Test_popupwin_previewpopup_5.dump @@ -2,12 +2,12 @@ |#|i|n|c|l|u|d|e| |"|X|h|e|a|d|e|r|.|h|"| @54 |t|h|r|e@1| @69 |f|o|u|r| @70 -|f|i|v|e| @28|╔+0&#afffff255| |t|e|s|t|d|i|r|/|X|t|a|g|f|i|l|e| |═@21|X -|s+0&#ffffff0|i|x| @29|║+0&#afffff255|2|7| @36| +0&#a8a8a8255|║+0&#afffff255 -|s+0&#ffffff0|e|v|e|n| @27|║+0&#afffff255|t|h|i|s| |i|s| |a|n|o|t|h|e|r| |p|l|a|c|e| @17| +0&#a8a8a8255|║+0&#afffff255 -|f+0&#ffffff0|i|n|d| |t|h|e|w|o|r|d| |s|o|m|e|w|h|e|r|e| @10|║+0&#afffff255|2|9| @36| +0|║+0&#afffff255 -|n+0&#ffffff0|i|n|e| @28|║+0&#afffff255|3|0| @36| +0&#a8a8a8255|║+0&#afffff255 -|t+0&#ffffff0|h|i|s| |i|s| |a|n|o|t|h|e|r| |w|o|r|d| @12|╚+0&#afffff255|═@39|⇲ +|f|i|v|e| @27|╔+0&#afffff255| |t|e|s|t|d|i|r|/|X|t|a|g|f|i|l|e| |═@22|X +|s+0&#ffffff0|i|x| @28|║+0&#afffff255|2|7| @37| +0&#a8a8a8255|║+0&#afffff255 +|s+0&#ffffff0|e|v|e|n| @26|║+0&#afffff255|t|h|i|s| |i|s| |a|n|o|t|h|e|r| |p|l|a|c|e| @18| +0&#a8a8a8255|║+0&#afffff255 +|f+0&#ffffff0|i|n|d| |t|h|e|w|o|r|d| |s|o|m|e|w|h|e|r|e| @9|║+0&#afffff255|2|9| @37| +0|║+0&#afffff255 +|n+0&#ffffff0|i|n|e| @27|║+0&#afffff255|3|0| @37| +0&#a8a8a8255|║+0&#afffff255 +|t+0&#ffffff0|h|i|s| |i|s| |a|n|o|t|h|e|r| |w|o|r|d| @11|╚+0&#afffff255|═@40|⇲ |v+0&#ffffff0|e|r|y| |l|o|n|g| |l|i|n|e| |w|h|e|r|e| |t|h|e| |w|o|r|d| |i|s| |a|l|s|o| >a|n|o|t|h|e|r| @29 |~+0#4040ff13&| @73 |~| @73 diff --git a/src/testdir/dumps/Test_popupwin_previewpopup_7.dump b/src/testdir/dumps/Test_popupwin_previewpopup_7.dump --- a/src/testdir/dumps/Test_popupwin_previewpopup_7.dump +++ b/src/testdir/dumps/Test_popupwin_previewpopup_7.dump @@ -2,12 +2,12 @@ |#|i|n|c|l|u|d|e| |"|X|h|e|a|d|e|r|.|h|"| @54 |t|h|r|e@1| @69 |f|o|u|r| @70 -|f|i|v|e| @28|╔+0#0000001#ffd7ff255| |X|t|a|g|f|i|l|e| |═@29|X -|s+0#0000000#ffffff0|i|x| @29|║+0#0000001#ffd7ff255|2|0| @36| +0#0000000#a8a8a8255|║+0#0000001#ffd7ff255 -|s+0#0000000#ffffff0|e|v|e|n| @27|║+0#0000001#ffd7ff255|t|h|e|w|o|r|d| |i|s| |h|e|r|e| @23| +0#0000000#a8a8a8255|║+0#0000001#ffd7ff255 -|f+0#0000000#ffffff0|i|n|d| |t|h|e|w|o|r|d| |s|o|m|e|w|h|e|r|e| @10|║+0#0000001#ffd7ff255|2@1| @36| +0#0000000#0000001|║+0#0000001#ffd7ff255 -|n+0#0000000#ffffff0|i|n|e| @28|║+0#0000001#ffd7ff255|2|3| @36| +0#0000000#a8a8a8255|║+0#0000001#ffd7ff255 -|t+0#0000000#ffffff0|h|i|s| |i|s| |a|n|o|t|h|e|r| |w|o|r|d| @12|╚+0#0000001#ffd7ff255|═@39|⇲ +|f|i|v|e| @27|╔+0#0000001#ffd7ff255| |X|t|a|g|f|i|l|e| |═@30|X +|s+0#0000000#ffffff0|i|x| @28|║+0#0000001#ffd7ff255|2|0| @37| +0#0000000#a8a8a8255|║+0#0000001#ffd7ff255 +|s+0#0000000#ffffff0|e|v|e|n| @26|║+0#0000001#ffd7ff255|t|h|e|w|o|r|d| |i|s| |h|e|r|e| @24| +0#0000000#a8a8a8255|║+0#0000001#ffd7ff255 +|f+0#0000000#ffffff0|i|n|d| |t|h|e|w|o|r|d| |s|o|m|e|w|h|e|r|e| @9|║+0#0000001#ffd7ff255|2@1| @37| +0#0000000#0000001|║+0#0000001#ffd7ff255 +|n+0#0000000#ffffff0|i|n|e| @27|║+0#0000001#ffd7ff255|2|3| @37| +0#0000000#a8a8a8255|║+0#0000001#ffd7ff255 +|t+0#0000000#ffffff0|h|i|s| |i|s| |a|n|o|t|h|e|r| |w|o|r|d| @11|╚+0#0000001#ffd7ff255|═@40|⇲ |v+0#0000000#ffffff0|e|r|y| |l|o|n|g| |l|i|n|e| |w|h|e|r|e| |t|h|e| |w|o|r|d| |i|s| |a|l|s|o| >a|n|o|t|h|e|r| @29 |~+0#4040ff13&| @73 |~| @73 diff --git a/src/testdir/dumps/Test_popupwin_previewpopup_8.dump b/src/testdir/dumps/Test_popupwin_previewpopup_8.dump --- a/src/testdir/dumps/Test_popupwin_previewpopup_8.dump +++ b/src/testdir/dumps/Test_popupwin_previewpopup_8.dump @@ -2,12 +2,12 @@ |#|i|n|c|l|u|d|e| |"|X|h|e|a|d|e|r|.|h|"| @54 |t|h|r|e@1| @69 |f|o|u|r| @70 -|f|i|v|e| @28|╔+0#0000001#ffd7ff255| |X|h|e|a|d|e|r|.|h| |═@28|X -|s+0#0000000#ffffff0|i|x| @29|║+0#0000001#ffd7ff255|1+0#e000002&|0| +0#0000001&@36| +0#0000000#a8a8a8255|║+0#0000001#ffd7ff255 -|s+0#0000000#ffffff0|e|v|e|n| @27|║+0#0000001#ffd7ff255|s|e|a|r|c|h|e|d| |w|o|r|d| |i|s| |h|e|r|e| @17| +0#0000000#a8a8a8255|║+0#0000001#ffd7ff255 -|f+0#0000000#ffffff0|i|n|d| |t|h|e|w|o|r|d| |s|o|m|e|w|h|e|r|e| @10|║+0#0000001#ffd7ff255|1+0#e000002&|2| +0#0000001&@36| +0#0000000#0000001|║+0#0000001#ffd7ff255 -|n+0#0000000#ffffff0|i|n|e| @28|║+0#0000001#ffd7ff255|1+0#e000002&|3| +0#0000001&@36| +0#0000000#a8a8a8255|║+0#0000001#ffd7ff255 -|t+0#0000000#ffffff0|h|i|s| |i|s| |a|n|o|t|h|e|r| |w|o|r|d| @12|╚+0#0000001#ffd7ff255|═@39|⇲ +|f|i|v|e| @27|╔+0#0000001#ffd7ff255| |X|h|e|a|d|e|r|.|h| |═@29|X +|s+0#0000000#ffffff0|i|x| @28|║+0#0000001#ffd7ff255|1+0#e000002&|0| +0#0000001&@37| +0#0000000#a8a8a8255|║+0#0000001#ffd7ff255 +|s+0#0000000#ffffff0|e|v|e|n| @26|║+0#0000001#ffd7ff255|s|e|a|r|c|h|e|d| |w|o|r|d| |i|s| |h|e|r|e| @18| +0#0000000#a8a8a8255|║+0#0000001#ffd7ff255 +|f+0#0000000#ffffff0|i|n|d| |t|h|e|w|o|r|d| |s|o|m|e|w|h|e|r|e| @9|║+0#0000001#ffd7ff255|1+0#e000002&|2| +0#0000001&@37| +0#0000000#0000001|║+0#0000001#ffd7ff255 +|n+0#0000000#ffffff0|i|n|e| @27|║+0#0000001#ffd7ff255|1+0#e000002&|3| +0#0000001&@37| +0#0000000#a8a8a8255|║+0#0000001#ffd7ff255 +|t+0#0000000#ffffff0|h|i|s| |i|s| |a|n|o|t|h|e|r| |w|o|r|d| @11|╚+0#0000001#ffd7ff255|═@40|⇲ |v+0#0000000#ffffff0|e|r|y| |l|o|n|g| |l|i|n|e| |w|h|e|r|e| |t|h|e| |w|o|r|d| |i|s| |a|l|s|o| >a|n|o|t|h|e|r| @29 |~+0#4040ff13&| @73 |~| @73 diff --git a/src/testdir/dumps/Test_popupwin_previewpopup_9.dump b/src/testdir/dumps/Test_popupwin_previewpopup_9.dump --- a/src/testdir/dumps/Test_popupwin_previewpopup_9.dump +++ b/src/testdir/dumps/Test_popupwin_previewpopup_9.dump @@ -2,12 +2,12 @@ |#|i|n|c|l|u|d|e| |"|X|h|e|a|d|e|r|.|h|"| @54 |t|h|r|e@1| @69 |f|o|u|r| @70 -|f|i|v|e| @28|╔+0#0000001#ffd7ff255| |X|h|e|a|d|e|r|.|h| |═@28|X -|s+0#0000000#ffffff0|i|x| @29|║+0#0000001#ffd7ff255|1+0#e000002&|0| +0#0000001&@36| +0#0000000#a8a8a8255|║+0#0000001#ffd7ff255 -|s+0#0000000#ffffff0|e|v|e|n| @27|║+0#0000001#ffd7ff255|s|e|a|r|c|h|e|d| |w|o|r|d| |i|s| |h|e|r|e| @17| +0#0000000#a8a8a8255|║+0#0000001#ffd7ff255 -|f+0#0000000#ffffff0|i|n|d| |t|h|e|w|o|r|d| |s|o|m|e|w|h|e|r|e| @10|║+0#0000001#ffd7ff255|1+0#e000002&|2| +0#0000001&@36| +0#0000000#0000001|║+0#0000001#ffd7ff255 -|n+0#0000000#ffffff0|i|n|e| @28|║+0#0000001#ffd7ff255|1+0#e000002&|3| +0#0000001&@36| +0#0000000#a8a8a8255|║+0#0000001#ffd7ff255 -|t+0#0000000#ffffff0|h|i|s| |i|s| |a|n|o|t|h|e|r| |w|o|r|d| @12|╚+0#0000001#ffd7ff255|═@39|⇲ +|f|i|v|e| @27|╔+0#0000001#ffd7ff255| |X|h|e|a|d|e|r|.|h| |═@29|X +|s+0#0000000#ffffff0|i|x| @28|║+0#0000001#ffd7ff255|1+0#e000002&|0| +0#0000001&@37| +0#0000000#a8a8a8255|║+0#0000001#ffd7ff255 +|s+0#0000000#ffffff0|e|v|e|n| @26|║+0#0000001#ffd7ff255|s|e|a|r|c|h|e|d| |w|o|r|d| |i|s| |h|e|r|e| @18| +0#0000000#a8a8a8255|║+0#0000001#ffd7ff255 +|f+0#0000000#ffffff0|i|n|d| |t|h|e|w|o|r|d| |s|o|m|e|w|h|e|r|e| @9|║+0#0000001#ffd7ff255|1+0#e000002&|2| +0#0000001&@37| +0#0000000#0000001|║+0#0000001#ffd7ff255 +|n+0#0000000#ffffff0|i|n|e| @27|║+0#0000001#ffd7ff255|1+0#e000002&|3| +0#0000001&@37| +0#0000000#a8a8a8255|║+0#0000001#ffd7ff255 +|t+0#0000000#ffffff0|h|i|s| |i|s| |a|n|o|t|h|e|r| |w|o|r|d| @11|╚+0#0000001#ffd7ff255|═@40|⇲ |v+0#0000000#ffffff0|e|r|y| |l|o|n|g| |l|i|n|e| |w|h|e|r|e| |t|h|e| |w|o|r|d| |i|s| |a|l|s|o| >a|n|o|t|h|e|r| @29 |~+0#4040ff13&| @73 |~| @73 diff --git a/src/testdir/test_popupwin.vim b/src/testdir/test_popupwin.vim --- a/src/testdir/test_popupwin.vim +++ b/src/testdir/test_popupwin.vim @@ -616,6 +616,50 @@ func Test_popup_drag() call delete('XtestPopupDrag') endfunc +func Test_popup_drag_minwidth() + CheckScreendump + + " create a popup that does not fit + let lines =<< trim END + call range(40) + \ ->map({_,i -> string(i)}) + \ ->popup_create({ + \ 'drag': 1, + \ 'wrap': 0, + \ 'border': [], + \ 'scrollbar': 1, + \ 'minwidth': 100, + \ 'filter': {w, k -> k ==# 'q' ? len([popup_close(w)]) : 0}, + \ }) + func DragitDown() + map :call test_setmouse(1, 10) + map :call test_setmouse(5, 40) + call feedkeys("\\\\\", "xt") + endfunc + func DragitUp() + map :call test_setmouse(5, 40) + map :call test_setmouse(4, 40) + map :call test_setmouse(3, 40) + call feedkeys("\\\\\\\", "xt") + endfunc + END + call writefile(lines, 'XtestPopupDrag') + let buf = RunVimInTerminal('-S XtestPopupDrag', #{rows: 10}) + call VerifyScreenDump(buf, 'Test_popupwin_drag_minwidth_1', {}) + + call term_sendkeys(buf, ":call DragitDown()\") + call VerifyScreenDump(buf, 'Test_popupwin_drag_minwidth_2', {}) + + call term_sendkeys(buf, ":call DragitUp()\") + call VerifyScreenDump(buf, 'Test_popupwin_drag_minwidth_3', {}) + + call term_sendkeys(buf, 'q') + + " clean up + call StopVimInTerminal(buf) + call delete('XtestPopupDrag') +endfunc + func Test_popup_drag_termwin() CheckUnix CheckScreendump diff --git a/src/version.c b/src/version.c --- a/src/version.c +++ b/src/version.c @@ -751,6 +751,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 4665, +/**/ 4664, /**/ 4663,