To: vim_dev@googlegroups.com Subject: Patch 8.1.1550 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.1550 Problem: When a popup has left padding text may be cut off. Solution: Add the border and padding when computing the size. Files: src/popupwin.c, src/testdir/test_popupwin.vim, src/testdir/dumps/Test_popupwin_20.dump, src/testdir/dumps/Test_popupwin_21.dump *** ../vim-8.1.1549/src/popupwin.c 2019-06-15 21:46:25.944960493 +0200 --- src/popupwin.c 2019-06-15 22:10:49.744126323 +0200 *************** *** 588,594 **** // When centering or right aligned, use maximum width. // When left aligned use the space available, but shift to the left when we // hit the right of the screen. ! maxwidth = Columns - wp->w_wincol; if (wp->w_maxwidth > 0 && maxwidth > wp->w_maxwidth) { allow_adjust_left = FALSE; --- 588,594 ---- // When centering or right aligned, use maximum width. // When left aligned use the space available, but shift to the left when we // hit the right of the screen. ! maxwidth = Columns - wp->w_wincol - left_extra; if (wp->w_maxwidth > 0 && maxwidth > wp->w_maxwidth) { allow_adjust_left = FALSE; *************** *** 622,632 **** || wp->w_popup_pos == POPPOS_BOTLEFT)) { // adjust leftwise to fit text on screen ! int shift_by = ( len - maxwidth ); ! if ( shift_by > wp->w_wincol ) { int truncate_shift = shift_by - wp->w_wincol; len -= truncate_shift; shift_by -= truncate_shift; } --- 622,633 ---- || wp->w_popup_pos == POPPOS_BOTLEFT)) { // adjust leftwise to fit text on screen ! int shift_by = len - maxwidth; ! if (shift_by > wp->w_wincol) { int truncate_shift = shift_by - wp->w_wincol; + len -= truncate_shift; shift_by -= truncate_shift; } *** ../vim-8.1.1549/src/testdir/test_popupwin.vim 2019-06-15 21:46:25.948960483 +0200 --- src/testdir/test_popupwin.vim 2019-06-15 22:25:27.026748028 +0200 *************** *** 87,92 **** --- 87,94 ---- \ "call popup_create('hello both', {'line': 2, 'col': 43, 'border': [], 'padding': []})", \ "call popup_create('border TL', {'line': 6, 'col': 3, 'border': [1, 0, 0, 4]})", \ "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]})", \], 'XtestPopupBorder') let buf = RunVimInTerminal('-S XtestPopupBorder', {'rows': 15}) call VerifyScreenDump(buf, 'Test_popupwin_2' .. iter, {}) *** ../vim-8.1.1549/src/testdir/dumps/Test_popupwin_20.dump 2019-06-01 20:16:33.717894147 +0200 --- src/testdir/dumps/Test_popupwin_20.dump 2019-06-15 22:23:05.111644042 +0200 *************** *** 5,15 **** |5| @40||+0#0000001#ffd7ff255| @11||| +0#0000000#ffffff0@18 |6| |++0#0000001#ffd7ff255|-@8| +0#0000000#ffffff0@9| +0#0000001#ffd7ff255@14| +0#0000000#ffffff0@4|++0#0000001#ffd7ff255|-@11|+| +0#0000000#ffffff0@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@37 ! |9| @20| +0#0000001#ffd7ff255@14| +0#0000000#ffffff0@37 ! |1|0| @72 ! |1@1| @72 ! |1|2| @72 |1|3| @72 |1|4| @72 @57|1|,|1| @10|T|o|p| --- 5,15 ---- |5| @40||+0#0000001#ffd7ff255| @11||| +0#0000000#ffffff0@18 |6| |++0#0000001#ffd7ff255|-@8| +0#0000000#ffffff0@9| +0#0000001#ffd7ff255@14| +0#0000000#ffffff0@4|++0#0000001#ffd7ff255|-@11|+| +0#0000000#ffffff0@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@16||+0#0000001#ffd7ff255| @2|w|r|a|p@1|e|d| |l|o|n|g|e|r| |t|e ! |9+0#0000000#ffffff0| @20| +0#0000001#ffd7ff255@14| +0#0000000#ffffff0@16||+0#0000001#ffd7ff255| @2|x|t| @14 ! |1+0#0000000#ffffff0|0| @72 ! |1@1| @50||+0#0000001#ffd7ff255| @2|r|i|g|h|t| |a|l|i|g|n|e|d| |t|e|x|t ! |1+0#0000000#ffffff0|2| @72 |1|3| @72 |1|4| @72 @57|1|,|1| @10|T|o|p| *** ../vim-8.1.1549/src/testdir/dumps/Test_popupwin_21.dump 2019-06-01 20:45:05.090694398 +0200 --- src/testdir/dumps/Test_popupwin_21.dump 2019-06-15 22:23:06.243636603 +0200 *************** *** 5,15 **** |5| @40|║+0#0000001#ffd7ff255| @11|║| +0#0000000#ffffff0@18 |6| |╔+0#0000001#ffd7ff255|═@8| +0#0000000#ffffff0@9| +0#0000001#ffd7ff255@14| +0#0000000#ffffff0@4|╚+0#0000001#ffd7ff255|═@11|╝| +0#0000000#ffffff0@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@37 ! |9| @20| +0#0000001#ffd7ff255@14| +0#0000000#ffffff0@37 ! |1|0| @72 ! |1@1| @72 ! |1|2| @72 |1|3| @72 |1|4| @72 @57|1|,|1| @10|T|o|p| --- 5,15 ---- |5| @40|║+0#0000001#ffd7ff255| @11|║| +0#0000000#ffffff0@18 |6| |╔+0#0000001#ffd7ff255|═@8| +0#0000000#ffffff0@9| +0#0000001#ffd7ff255@14| +0#0000000#ffffff0@4|╚+0#0000001#ffd7ff255|═@11|╝| +0#0000000#ffffff0@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@16|║+0#0000001#ffd7ff255| @2|w|r|a|p@1|e|d| |l|o|n|g|e|r| |t|e ! |9+0#0000000#ffffff0| @20| +0#0000001#ffd7ff255@14| +0#0000000#ffffff0@16|║+0#0000001#ffd7ff255| @2|x|t| @14 ! |1+0#0000000#ffffff0|0| @72 ! |1@1| @50|║+0#0000001#ffd7ff255| @2|r|i|g|h|t| |a|l|i|g|n|e|d| |t|e|x|t ! |1+0#0000000#ffffff0|2| @72 |1|3| @72 |1|4| @72 @57|1|,|1| @10|T|o|p| *** ../vim-8.1.1549/src/version.c 2019-06-15 21:56:13.683314597 +0200 --- src/version.c 2019-06-15 22:15:32.027041621 +0200 *************** *** 779,780 **** --- 779,782 ---- { /* Add new patch number below this line */ + /**/ + 1550, /**/ -- % cat /usr/include/sys/errno.h #define EPERM 1 /* Operation not permitted */ #define ENOENT 2 /* No such file or directory */ #define ESRCH 3 /* No such process */ [...] #define EMACS 666 /* Too many macros */ % /// 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 ///