1
0
forked from aniani/vim

patch 8.1.1550: when a popup has left padding text may be cut off

Problem:    When a popup has left padding text may be cut off.
Solution:   Add the border and padding when computing the size.
This commit is contained in:
Bram Moolenaar
2019-06-15 22:27:23 +02:00
parent 61eeeea8e6
commit 51c3131040
5 changed files with 18 additions and 13 deletions

View File

@@ -588,7 +588,7 @@ popup_adjust_position(win_T *wp)
// 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;
maxwidth = Columns - wp->w_wincol - left_extra;
if (wp->w_maxwidth > 0 && maxwidth > wp->w_maxwidth)
{
allow_adjust_left = FALSE;
@@ -622,11 +622,12 @@ popup_adjust_position(win_T *wp)
|| wp->w_popup_pos == POPPOS_BOTLEFT))
{
// adjust leftwise to fit text on screen
int shift_by = ( len - maxwidth );
int shift_by = len - maxwidth;
if ( shift_by > wp->w_wincol )
if (shift_by > wp->w_wincol)
{
int truncate_shift = shift_by - wp->w_wincol;
len -= truncate_shift;
shift_by -= truncate_shift;
}