comparison src/popupwin.c @ 17101:1a23650f8da5 v8.1.1550

patch 8.1.1550: when a popup has left padding text may be cut off commit https://github.com/vim/vim/commit/51c313104096c7af5024aebbf295f7f03486874b Author: Bram Moolenaar <Bram@vim.org> Date: Sat Jun 15 22:27:23 2019 +0200 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.
author Bram Moolenaar <Bram@vim.org>
date Sat, 15 Jun 2019 22:30:05 +0200
parents 94007c802045
children 0001d10a7661
comparison
equal deleted inserted replaced
17100:1ae2ef73bcd0 17101:1a23650f8da5
586 } 586 }
587 587
588 // When centering or right aligned, use maximum width. 588 // When centering or right aligned, use maximum width.
589 // When left aligned use the space available, but shift to the left when we 589 // When left aligned use the space available, but shift to the left when we
590 // hit the right of the screen. 590 // hit the right of the screen.
591 maxwidth = Columns - wp->w_wincol; 591 maxwidth = Columns - wp->w_wincol - left_extra;
592 if (wp->w_maxwidth > 0 && maxwidth > wp->w_maxwidth) 592 if (wp->w_maxwidth > 0 && maxwidth > wp->w_maxwidth)
593 { 593 {
594 allow_adjust_left = FALSE; 594 allow_adjust_left = FALSE;
595 maxwidth = wp->w_maxwidth; 595 maxwidth = wp->w_maxwidth;
596 } 596 }
620 && allow_adjust_left 620 && allow_adjust_left
621 && (wp->w_popup_pos == POPPOS_TOPLEFT 621 && (wp->w_popup_pos == POPPOS_TOPLEFT
622 || wp->w_popup_pos == POPPOS_BOTLEFT)) 622 || wp->w_popup_pos == POPPOS_BOTLEFT))
623 { 623 {
624 // adjust leftwise to fit text on screen 624 // adjust leftwise to fit text on screen
625 int shift_by = ( len - maxwidth ); 625 int shift_by = len - maxwidth;
626 626
627 if ( shift_by > wp->w_wincol ) 627 if (shift_by > wp->w_wincol)
628 { 628 {
629 int truncate_shift = shift_by - wp->w_wincol; 629 int truncate_shift = shift_by - wp->w_wincol;
630
630 len -= truncate_shift; 631 len -= truncate_shift;
631 shift_by -= truncate_shift; 632 shift_by -= truncate_shift;
632 } 633 }
633 634
634 wp->w_wincol -= shift_by; 635 wp->w_wincol -= shift_by;