comparison src/popupwin.c @ 18588:7dfdc319f4ff v8.1.2288

patch 8.1.2288: not using all space when popup with "topleft" flips to above Commit: https://github.com/vim/vim/commit/5c6b6187ac51a4d8545e823c1be6cdf70cac8a57 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Nov 10 17:51:38 2019 +0100 patch 8.1.2288: not using all space when popup with "topleft" flips to above Problem: Not using all space when popup with "topleft" flips to above. Solution: Recompute the height when a popup flips from below to above. (closes #5151)
author Bram Moolenaar <Bram@vim.org>
date Sun, 10 Nov 2019 18:00:03 +0100
parents 351659cbadb4
children b10ef01555c8
comparison
equal deleted inserted replaced
18587:e286c3a6a456 18588:7dfdc319f4ff
1100 int right_extra = wp->w_popup_border[1] + wp->w_popup_padding[1]; 1100 int right_extra = wp->w_popup_border[1] + wp->w_popup_padding[1];
1101 int bot_extra = wp->w_popup_border[2] + wp->w_popup_padding[2]; 1101 int bot_extra = wp->w_popup_border[2] + wp->w_popup_padding[2];
1102 int left_extra = wp->w_popup_border[3] + wp->w_popup_padding[3]; 1102 int left_extra = wp->w_popup_border[3] + wp->w_popup_padding[3];
1103 int extra_height = top_extra + bot_extra; 1103 int extra_height = top_extra + bot_extra;
1104 int extra_width = left_extra + right_extra; 1104 int extra_width = left_extra + right_extra;
1105 int w_height_before_limit;
1105 int org_winrow = wp->w_winrow; 1106 int org_winrow = wp->w_winrow;
1106 int org_wincol = wp->w_wincol; 1107 int org_wincol = wp->w_wincol;
1107 int org_width = wp->w_width; 1108 int org_width = wp->w_width;
1108 int org_height = wp->w_height; 1109 int org_height = wp->w_height;
1109 int org_leftcol = wp->w_leftcol; 1110 int org_leftcol = wp->w_leftcol;
1397 + 1 + wrapped; 1398 + 1 + wrapped;
1398 if (wp->w_minheight > 0 && wp->w_height < wp->w_minheight) 1399 if (wp->w_minheight > 0 && wp->w_height < wp->w_minheight)
1399 wp->w_height = wp->w_minheight; 1400 wp->w_height = wp->w_minheight;
1400 if (wp->w_maxheight > 0 && wp->w_height > wp->w_maxheight) 1401 if (wp->w_maxheight > 0 && wp->w_height > wp->w_maxheight)
1401 wp->w_height = wp->w_maxheight; 1402 wp->w_height = wp->w_maxheight;
1403 w_height_before_limit = wp->w_height;
1402 if (wp->w_height > Rows - wp->w_winrow) 1404 if (wp->w_height > Rows - wp->w_winrow)
1403 wp->w_height = Rows - wp->w_winrow; 1405 wp->w_height = Rows - wp->w_winrow;
1404 if (wp->w_height != org_height) 1406 if (wp->w_height != org_height)
1405 win_comp_scroll(wp); 1407 win_comp_scroll(wp);
1406 1408
1432 || wp->w_popup_pos == POPPOS_TOPLEFT) 1434 || wp->w_popup_pos == POPPOS_TOPLEFT)
1433 { 1435 {
1434 if (wantline + (wp->w_height + extra_height) - 1 > Rows 1436 if (wantline + (wp->w_height + extra_height) - 1 > Rows
1435 && wantline * 2 > Rows 1437 && wantline * 2 > Rows
1436 && (wp->w_popup_flags & POPF_POSINVERT)) 1438 && (wp->w_popup_flags & POPF_POSINVERT))
1439 {
1437 // top aligned and not enough space below but there is space above: 1440 // top aligned and not enough space below but there is space above:
1438 // make bottom aligned 1441 // make bottom aligned and recompute the height
1442 wp->w_height = w_height_before_limit;
1439 wp->w_winrow = wantline - 2 - wp->w_height - extra_height; 1443 wp->w_winrow = wantline - 2 - wp->w_height - extra_height;
1444 if (wp->w_winrow < 0)
1445 {
1446 wp->w_height += wp->w_winrow;
1447 wp->w_winrow = 0;
1448 }
1449 }
1440 else 1450 else
1441 wp->w_winrow = wantline - 1; 1451 wp->w_winrow = wantline - 1;
1442 } 1452 }
1443 if (wp->w_winrow >= Rows) 1453 if (wp->w_winrow >= Rows)
1444 wp->w_winrow = Rows - 1; 1454 wp->w_winrow = Rows - 1;