Mercurial > vim
diff 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 |
line wrap: on
line diff
--- a/src/popupwin.c +++ b/src/popupwin.c @@ -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; }