Mercurial > vim
comparison src/popupwin.c @ 17354:102ed3a26a5d v8.1.1676
patch 8.1.1676: "maxwidth" of popup window does not always work properly
commit https://github.com/vim/vim/commit/017c2699381be17131a02f051ecb812067289856
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Jul 13 14:17:51 2019 +0200
patch 8.1.1676: "maxwidth" of popup window does not always work properly
Problem: "maxwidth" of popup window does not always work properly.
Solution: Adjust the computation. (Naruhiko Nishino, closes https://github.com/vim/vim/issues/4653)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 13 Jul 2019 14:30:05 +0200 |
parents | d82b0cfb1e82 |
children | d1ea88736ebd |
comparison
equal
deleted
inserted
replaced
17353:c8a1757026ed | 17354:102ed3a26a5d |
---|---|
797 * scrollbar. | 797 * scrollbar. |
798 */ | 798 */ |
799 int | 799 int |
800 popup_width(win_T *wp) | 800 popup_width(win_T *wp) |
801 { | 801 { |
802 // w_leftcol is how many columns of the core are left of the screen | |
803 // w_popup_rightoff is how many columns of the core are right of the screen | |
802 return wp->w_width + wp->w_leftcol | 804 return wp->w_width + wp->w_leftcol |
803 + wp->w_popup_padding[3] + wp->w_popup_border[3] | 805 + wp->w_popup_padding[3] + wp->w_popup_border[3] |
804 + wp->w_popup_padding[1] + wp->w_popup_border[1] | 806 + wp->w_popup_padding[1] + wp->w_popup_border[1] |
805 + wp->w_has_scrollbar | 807 + wp->w_has_scrollbar |
806 + wp->w_popup_rightoff; | 808 + wp->w_popup_rightoff; |
922 wp->w_wincol -= shift_by; | 924 wp->w_wincol -= shift_by; |
923 maxwidth += shift_by; | 925 maxwidth += shift_by; |
924 wp->w_width = maxwidth; | 926 wp->w_width = maxwidth; |
925 } | 927 } |
926 if (wp->w_width < len) | 928 if (wp->w_width < len) |
929 { | |
927 wp->w_width = len; | 930 wp->w_width = len; |
931 if (wp->w_maxwidth > 0 && wp->w_width > wp->w_maxwidth) | |
932 wp->w_width = wp->w_maxwidth; | |
933 } | |
928 // do not use the width of lines we're not going to show | 934 // do not use the width of lines we're not going to show |
929 if (wp->w_maxheight > 0 | 935 if (wp->w_maxheight > 0 |
930 && lnum - wp->w_topline + 1 + wrapped > wp->w_maxheight) | 936 && lnum - wp->w_topline + 1 + wrapped > wp->w_maxheight) |
931 break; | 937 break; |
932 } | 938 } |