# HG changeset patch # User Bram Moolenaar # Date 1578348903 -3600 # Node ID 48e0208f53c2ab46b0bd3ce250e8cdceeef0ef59 # Parent 996e917b1edb6ea56c3c23083fb9964fefff17cc patch 8.2.0096: cannot create tiny popup window in last column Commit: https://github.com/vim/vim/commit/fbcdf671f08cd2c7e60f35574231df0421112d99 Author: Bram Moolenaar Date: Mon Jan 6 23:07:48 2020 +0100 patch 8.2.0096: cannot create tiny popup window in last column Problem: Cannot create tiny popup window in last column. (Daniel Steinberg) Solution: Remove position limit. (closes https://github.com/vim/vim/issues/5447) diff --git a/src/popupwin.c b/src/popupwin.c --- a/src/popupwin.c +++ b/src/popupwin.c @@ -1222,8 +1222,8 @@ popup_adjust_position(win_T *wp) || wp->w_popup_pos == POPPOS_BOTLEFT)) { wp->w_wincol = wantcol - 1; - if (wp->w_wincol >= Columns - 3) - wp->w_wincol = Columns - 3; + if (wp->w_wincol >= Columns - 1) + wp->w_wincol = Columns - 1; } } diff --git a/src/testdir/dumps/Test_popupwin_20.dump b/src/testdir/dumps/Test_popupwin_20.dump --- a/src/testdir/dumps/Test_popupwin_20.dump +++ b/src/testdir/dumps/Test_popupwin_20.dump @@ -1,9 +1,9 @@ >1+0&#ffffff0| @73 -|2| |++0#0000001#ffd7ff255|-@11|+| +0#0000000#ffffff0@5| +0#0000001#ffd7ff255@14| +0#0000000#ffffff0@4|+|-@11|+| @18 -|3| ||+0#0000001#ffd7ff255|h|e|l@1|o| |b|o|r|d|e|r||| +0#0000000#ffffff0@5| +0#0000001#ffd7ff255|h|e|l@1|o| |p|a|d@1|i|n|g| | +0#0000000#ffffff0@4||| @11||| @18 -|4| |++0#0000001#ffd7ff255|-@11|+| +0#0000000#ffffff0@5| +0#0000001#ffd7ff255@14| +0#0000000#ffffff0@4||| |h|e|l@1|o| |b|o|t|h| ||| @18 -|5| @40||| @11||| @18 -|6| |++0#0000001#ffd7ff255|-@8| +0#0000000#ffffff0@9| +0#0000001#ffd7ff255@14| +0#0000000#ffffff0@4|+|-@11|+| @18 +|2| |++0#0000001#ffd7ff255|-@11|+| +0#0000000#ffffff0@5| +0#0000001#ffd7ff255@14| +0#0000000#ffffff0@4|+|-@11|+| @15|X+0#0000001#ffd7ff255| +0#0000000#ffffff0@1 +|3| ||+0#0000001#ffd7ff255|h|e|l@1|o| |b|o|r|d|e|r||| +0#0000000#ffffff0@5| +0#0000001#ffd7ff255|h|e|l@1|o| |p|a|d@1|i|n|g| | +0#0000000#ffffff0@4||| @11||| @16|X+0#0000001#ffd7ff255| +0#0000000#ffffff0 +|4| |++0#0000001#ffd7ff255|-@11|+| +0#0000000#ffffff0@5| +0#0000001#ffd7ff255@14| +0#0000000#ffffff0@4||| |h|e|l@1|o| |b|o|t|h| ||| @17|X+0#0000001#ffd7ff255 +|5+0#0000000#ffffff0| @40||| @11||| @17|X+0#0000001#ffd7ff255 +|6+0#0000000#ffffff0| |++0#0000001#ffd7ff255|-@8| +0#0000000#ffffff0@9| +0#0000001#ffd7ff255@14| +0#0000000#ffffff0@4|+|-@11|+| @18 |7| ||+0#0000001#ffd7ff255|b|o|r|d|e|r| |T|L| +0#0000000#ffffff0@9| +0#0000001#ffd7ff255@3|p|a|d@1|i|n|g|s| @2| +0#0000000#ffffff0@37 |8| @20| +0#0000001#ffd7ff255@14| +0#0000000#ffffff0@12||+0#0000001#ffd7ff255| @2|w|r|a|p@1|e|d| |l|o|n|g|e|r| |t|e| @2|| |9+0#0000000#ffffff0| @20| +0#0000001#ffd7ff255@14| +0#0000000#ffffff0@12||+0#0000001#ffd7ff255| @2|x|t| @17|| diff --git a/src/testdir/dumps/Test_popupwin_21.dump b/src/testdir/dumps/Test_popupwin_21.dump --- a/src/testdir/dumps/Test_popupwin_21.dump +++ b/src/testdir/dumps/Test_popupwin_21.dump @@ -1,9 +1,9 @@ >1+0&#ffffff0| @73 -|2| |╔+0#0000001#ffd7ff255|═@11|╗| +0#0000000#ffffff0@5| +0#0000001#ffd7ff255@14| +0#0000000#ffffff0@4|╔|═@11|╗| @18 -|3| |║+0#0000001#ffd7ff255|h|e|l@1|o| |b|o|r|d|e|r|║| +0#0000000#ffffff0@5| +0#0000001#ffd7ff255|h|e|l@1|o| |p|a|d@1|i|n|g| | +0#0000000#ffffff0@4|║| @11|║| @18 -|4| |╚+0#0000001#ffd7ff255|═@11|╝| +0#0000000#ffffff0@5| +0#0000001#ffd7ff255@14| +0#0000000#ffffff0@4|║| |h|e|l@1|o| |b|o|t|h| |║| @18 -|5| @40|║| @11|║| @18 -|6| |╔+0#0000001#ffd7ff255|═@8| +0#0000000#ffffff0@9| +0#0000001#ffd7ff255@14| +0#0000000#ffffff0@4|╚|═@11|╝| @18 +|2| |╔+0#0000001#ffd7ff255|═@11|╗| +0#0000000#ffffff0@5| +0#0000001#ffd7ff255@14| +0#0000000#ffffff0@4|╔|═@11|╗| @15|X+0#0000001#ffd7ff255| +0#0000000#ffffff0@1 +|3| |║+0#0000001#ffd7ff255|h|e|l@1|o| |b|o|r|d|e|r|║| +0#0000000#ffffff0@5| +0#0000001#ffd7ff255|h|e|l@1|o| |p|a|d@1|i|n|g| | +0#0000000#ffffff0@4|║| @11|║| @16|X+0#0000001#ffd7ff255| +0#0000000#ffffff0 +|4| |╚+0#0000001#ffd7ff255|═@11|╝| +0#0000000#ffffff0@5| +0#0000001#ffd7ff255@14| +0#0000000#ffffff0@4|║| |h|e|l@1|o| |b|o|t|h| |║| @17|X+0#0000001#ffd7ff255 +|5+0#0000000#ffffff0| @40|║| @11|║| @17|X+0#0000001#ffd7ff255 +|6+0#0000000#ffffff0| |╔+0#0000001#ffd7ff255|═@8| +0#0000000#ffffff0@9| +0#0000001#ffd7ff255@14| +0#0000000#ffffff0@4|╚|═@11|╝| @18 |7| |║+0#0000001#ffd7ff255|b|o|r|d|e|r| |T|L| +0#0000000#ffffff0@9| +0#0000001#ffd7ff255@3|p|a|d@1|i|n|g|s| @2| +0#0000000#ffffff0@37 |8| @20| +0#0000001#ffd7ff255@14| +0#0000000#ffffff0@12|║+0#0000001#ffd7ff255| @2|w|r|a|p@1|e|d| |l|o|n|g|e|r| |t|e| @2|║ |9+0#0000000#ffffff0| @20| +0#0000001#ffd7ff255@14| +0#0000000#ffffff0@12|║+0#0000001#ffd7ff255| @2|x|t| @17|║ 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 @@ -89,6 +89,10 @@ func Test_popup_with_border_and_padding( call popup_create('paddings', #{line: 6, col: 23, padding: [1, 3, 2, 4]}) call popup_create('wrapped longer text', #{line: 8, col: 55, padding: [0, 3, 0, 3], border: [0, 1, 0, 1]}) call popup_create('right aligned text', #{line: 11, col: 56, wrap: 0, padding: [0, 3, 0, 3], border: [0, 1, 0, 1]}) + call popup_create('X', #{line: 2, col: 73}) + call popup_create('X', #{line: 3, col: 74}) + call popup_create('X', #{line: 4, col: 75}) + call popup_create('X', #{line: 5, col: 76}) END call insert(lines, iter == 1 ? '' : 'set enc=latin1') call writefile(lines, 'XtestPopupBorder') @@ -1634,8 +1638,8 @@ func s:VerifyPosition(p, msg, line, col, endfunc func Test_popup_position_adjust() - " Anything placed past 2 cells from of the right of the screen is moved to the - " left. + " Anything placed past the last cell on the right of the screen is moved to + " the left. " " When wrapping is disabled, we also shift to the left to display on the " screen, unless fixed is set. @@ -1643,24 +1647,11 @@ func Test_popup_position_adjust() " Entries for cases which don't vary based on wrapping. " Format is per tests described below let both_wrap_tests = [ - \ ['a', 5, &columns, 5, &columns - 2, 1, 1], - \ ['b', 5, &columns + 1, 5, &columns - 2, 1, 1], - \ ['c', 5, &columns - 1, 5, &columns - 2, 1, 1], + \ ['a', 5, &columns, 5, &columns, 1, 1], + \ ['b', 5, &columns + 1, 5, &columns, 1, 1], + \ ['c', 5, &columns - 1, 5, &columns - 1, 1, 1], \ ['d', 5, &columns - 2, 5, &columns - 2, 1, 1], - \ ['e', 5, &columns - 3, 5, &columns - 3, 1, 1], - \ - \ ['aa', 5, &columns, 5, &columns - 2, 2, 1], - \ ['bb', 5, &columns + 1, 5, &columns - 2, 2, 1], - \ ['cc', 5, &columns - 1, 5, &columns - 2, 2, 1], - \ ['dd', 5, &columns - 2, 5, &columns - 2, 2, 1], - \ ['ee', 5, &columns - 3, 5, &columns - 3, 2, 1], - \ - \ ['aaa', 5, &columns, 5, &columns - 2, 3, 1], - \ ['bbb', 5, &columns + 1, 5, &columns - 2, 3, 1], - \ ['ccc', 5, &columns - 1, 5, &columns - 2, 3, 1], - \ ['ddd', 5, &columns - 2, 5, &columns - 2, 3, 1], - \ ['eee', 5, &columns - 3, 5, &columns - 3, 3, 1], - \ ] + \ ['e', 5, &columns - 3, 5, &columns - 3, 1, 1]] " these test groups are dicts with: " - comment: something to identify the group of tests by @@ -1681,11 +1672,24 @@ func Test_popup_position_adjust() \ pos: 'botleft', \ }, \ tests: both_wrap_tests + [ - \ ['aaaa', 5, &columns, 4, &columns - 2, 3, 2], - \ ['bbbb', 5, &columns + 1, 4, &columns - 2, 3, 2], - \ ['cccc', 5, &columns - 1, 4, &columns - 2, 3, 2], + \ ['aa', 5, &columns, 4, &columns, 1, 2], + \ ['bb', 5, &columns + 1, 4, &columns, 1, 2], + \ ['cc', 5, &columns - 1, 5, &columns - 1, 2, 1], + \ ['dd', 5, &columns - 2, 5, &columns - 2, 2, 1], + \ ['ee', 5, &columns - 3, 5, &columns - 3, 2, 1], + \ + \ ['aaa', 5, &columns, 3, &columns, 1, 3], + \ ['bbb', 5, &columns + 1, 3, &columns, 1, 3], + \ ['ccc', 5, &columns - 1, 4, &columns - 1, 2, 2], + \ ['ddd', 5, &columns - 2, 5, &columns - 2, 3, 1], + \ ['eee', 5, &columns - 3, 5, &columns - 3, 3, 1], + \ + \ ['aaaa', 5, &columns, 2, &columns, 1, 4], + \ ['bbbb', 5, &columns + 1, 2, &columns, 1, 4], + \ ['cccc', 5, &columns - 1, 4, &columns - 1, 2, 2], \ ['dddd', 5, &columns - 2, 4, &columns - 2, 3, 2], \ ['eeee', 5, &columns - 3, 5, &columns - 3, 4, 1], + \ ['eeee', 5, &columns - 4, 5, &columns - 4, 4, 1], \ ], \ }, \ #{ @@ -1695,6 +1699,18 @@ func Test_popup_position_adjust() \ pos: 'botleft', \ }, \ tests: both_wrap_tests + [ + \ ['aa', 5, &columns, 5, &columns - 1, 2, 1], + \ ['bb', 5, &columns + 1, 5, &columns - 1, 2, 1], + \ ['cc', 5, &columns - 1, 5, &columns - 1, 2, 1], + \ ['dd', 5, &columns - 2, 5, &columns - 2, 2, 1], + \ ['ee', 5, &columns - 3, 5, &columns - 3, 2, 1], + \ + \ ['aaa', 5, &columns, 5, &columns - 2, 3, 1], + \ ['bbb', 5, &columns + 1, 5, &columns - 2, 3, 1], + \ ['ccc', 5, &columns - 1, 5, &columns - 2, 3, 1], + \ ['ddd', 5, &columns - 2, 5, &columns - 2, 3, 1], + \ ['eee', 5, &columns - 3, 5, &columns - 3, 3, 1], + \ \ ['aaaa', 5, &columns, 5, &columns - 3, 4, 1], \ ['bbbb', 5, &columns + 1, 5, &columns - 3, 4, 1], \ ['cccc', 5, &columns - 1, 5, &columns - 3, 4, 1], @@ -1710,9 +1726,21 @@ func Test_popup_position_adjust() \ pos: 'botleft', \ }, \ tests: both_wrap_tests + [ - \ ['aaaa', 5, &columns, 5, &columns - 2, 3, 1], - \ ['bbbb', 5, &columns + 1, 5, &columns - 2, 3, 1], - \ ['cccc', 5, &columns - 1, 5, &columns - 2, 3, 1], + \ ['aa', 5, &columns, 5, &columns, 1, 1], + \ ['bb', 5, &columns + 1, 5, &columns, 1, 1], + \ ['cc', 5, &columns - 1, 5, &columns - 1, 2, 1], + \ ['dd', 5, &columns - 2, 5, &columns - 2, 2, 1], + \ ['ee', 5, &columns - 3, 5, &columns - 3, 2, 1], + \ + \ ['aaa', 5, &columns, 5, &columns, 1, 1], + \ ['bbb', 5, &columns + 1, 5, &columns, 1, 1], + \ ['ccc', 5, &columns - 1, 5, &columns - 1, 2, 1], + \ ['ddd', 5, &columns - 2, 5, &columns - 2, 3, 1], + \ ['eee', 5, &columns - 3, 5, &columns - 3, 3, 1], + \ + \ ['aaaa', 5, &columns, 5, &columns, 1, 1], + \ ['bbbb', 5, &columns + 1, 5, &columns, 1, 1], + \ ['cccc', 5, &columns - 1, 5, &columns - 1, 2, 1], \ ['dddd', 5, &columns - 2, 5, &columns - 2, 3, 1], \ ['eeee', 5, &columns - 3, 5, &columns - 3, 4, 1], \ ], diff --git a/src/version.c b/src/version.c --- a/src/version.c +++ b/src/version.c @@ -743,6 +743,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 96, +/**/ 95, /**/ 94,