Mercurial > vim
comparison src/popupwin.c @ 21729:f2ba8ebbab2b v8.2.1414
patch 8.2.1414: popupwindow missing last couple of lines
Commit: https://github.com/vim/vim/commit/bf61fdd00808bfa7cc61a82c719fc220bba50ba3
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Aug 10 20:39:17 2020 +0200
patch 8.2.1414: popupwindow missing last couple of lines
Problem: Popupwindow missing last couple of lines when cursor is in the
first line.
Solution: Compute the max height also when top aligned. (closes #6664)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 10 Aug 2020 20:45:05 +0200 |
parents | b997e872ff95 |
children | 48f9bf2c677d |
comparison
equal
deleted
inserted
replaced
21728:6329ff6950ff | 21729:f2ba8ebbab2b |
---|---|
1132 int minwidth, minheight; | 1132 int minwidth, minheight; |
1133 int maxheight = Rows; | 1133 int maxheight = Rows; |
1134 int wantline = wp->w_wantline; // adjusted for textprop | 1134 int wantline = wp->w_wantline; // adjusted for textprop |
1135 int wantcol = wp->w_wantcol; // adjusted for textprop | 1135 int wantcol = wp->w_wantcol; // adjusted for textprop |
1136 int use_wantcol = wantcol != 0; | 1136 int use_wantcol = wantcol != 0; |
1137 int adjust_height_for_top_aligned = FALSE; | |
1137 | 1138 |
1138 wp->w_winrow = 0; | 1139 wp->w_winrow = 0; |
1139 wp->w_wincol = 0; | 1140 wp->w_wincol = 0; |
1140 wp->w_leftcol = 0; | 1141 wp->w_leftcol = 0; |
1141 wp->w_popup_leftoff = 0; | 1142 wp->w_popup_leftoff = 0; |
1481 else | 1482 else |
1482 { | 1483 { |
1483 // Not enough space and more space on the other side: make top | 1484 // Not enough space and more space on the other side: make top |
1484 // aligned. | 1485 // aligned. |
1485 wp->w_winrow = (wantline < 0 ? 0 : wantline) + 1; | 1486 wp->w_winrow = (wantline < 0 ? 0 : wantline) + 1; |
1486 if (wp->w_winrow + wp->w_height + extra_height >= Rows) | 1487 adjust_height_for_top_aligned = TRUE; |
1487 { | |
1488 wp->w_height = Rows - wp->w_winrow - extra_height; | |
1489 if (wp->w_want_scrollbar | |
1490 #ifdef FEAT_TERMINAL | |
1491 && wp->w_buffer->b_term == NULL | |
1492 #endif | |
1493 ) | |
1494 wp->w_has_scrollbar = TRUE; | |
1495 } | |
1496 } | 1488 } |
1497 } | 1489 } |
1498 else if (wp->w_popup_pos == POPPOS_TOPRIGHT | 1490 else if (wp->w_popup_pos == POPPOS_TOPRIGHT |
1499 || wp->w_popup_pos == POPPOS_TOPLEFT) | 1491 || wp->w_popup_pos == POPPOS_TOPLEFT) |
1500 { | 1492 { |
1511 wp->w_height += wp->w_winrow; | 1503 wp->w_height += wp->w_winrow; |
1512 wp->w_winrow = 0; | 1504 wp->w_winrow = 0; |
1513 } | 1505 } |
1514 } | 1506 } |
1515 else | 1507 else |
1508 { | |
1516 wp->w_winrow = wantline - 1; | 1509 wp->w_winrow = wantline - 1; |
1517 } | 1510 adjust_height_for_top_aligned = TRUE; |
1518 // make sure w_window is valid | 1511 } |
1512 } | |
1513 | |
1514 if (adjust_height_for_top_aligned && wp->w_want_scrollbar | |
1515 && wp->w_winrow + wp->w_height + extra_height > Rows) | |
1516 { | |
1517 // Bottom of the popup goes below the last line, reduce the height and | |
1518 // add a scrollbar. | |
1519 wp->w_height = Rows - wp->w_winrow - extra_height; | |
1520 #ifdef FEAT_TERMINAL | |
1521 if (wp->w_buffer->b_term == NULL) | |
1522 #endif | |
1523 wp->w_has_scrollbar = TRUE; | |
1524 } | |
1525 | |
1526 // make sure w_winrow is valid | |
1519 if (wp->w_winrow >= Rows) | 1527 if (wp->w_winrow >= Rows) |
1520 wp->w_winrow = Rows - 1; | 1528 wp->w_winrow = Rows - 1; |
1521 else if (wp->w_winrow < 0) | 1529 else if (wp->w_winrow < 0) |
1522 wp->w_winrow = 0; | 1530 wp->w_winrow = 0; |
1523 | 1531 |