To: vim_dev@googlegroups.com Subject: Patch 8.2.1414 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.1414 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) Files: src/popupwin.c, src/testdir/test_popupwin.vim, src/testdir/dumps/Test_popupwin_toohigh_3.dump, src/testdir/dumps/Test_popupwin_nospace.dump *** ../vim-8.2.1413/src/popupwin.c 2020-08-09 16:36:45.870516749 +0200 --- src/popupwin.c 2020-08-10 20:33:46.645421511 +0200 *************** *** 1134,1139 **** --- 1134,1140 ---- int wantline = wp->w_wantline; // adjusted for textprop int wantcol = wp->w_wantcol; // adjusted for textprop int use_wantcol = wantcol != 0; + int adjust_height_for_top_aligned = FALSE; wp->w_winrow = 0; wp->w_wincol = 0; *************** *** 1483,1498 **** // Not enough space and more space on the other side: make top // aligned. wp->w_winrow = (wantline < 0 ? 0 : wantline) + 1; ! if (wp->w_winrow + wp->w_height + extra_height >= Rows) ! { ! wp->w_height = Rows - wp->w_winrow - extra_height; ! if (wp->w_want_scrollbar ! #ifdef FEAT_TERMINAL ! && wp->w_buffer->b_term == NULL ! #endif ! ) ! wp->w_has_scrollbar = TRUE; ! } } } else if (wp->w_popup_pos == POPPOS_TOPRIGHT --- 1484,1490 ---- // Not enough space and more space on the other side: make top // aligned. wp->w_winrow = (wantline < 0 ? 0 : wantline) + 1; ! adjust_height_for_top_aligned = TRUE; } } else if (wp->w_popup_pos == POPPOS_TOPRIGHT *************** *** 1513,1521 **** } } else wp->w_winrow = wantline - 1; } ! // make sure w_window is valid if (wp->w_winrow >= Rows) wp->w_winrow = Rows - 1; else if (wp->w_winrow < 0) --- 1505,1529 ---- } } else + { wp->w_winrow = wantline - 1; + adjust_height_for_top_aligned = TRUE; + } } ! ! if (adjust_height_for_top_aligned && wp->w_want_scrollbar ! && wp->w_winrow + wp->w_height + extra_height > Rows) ! { ! // Bottom of the popup goes below the last line, reduce the height and ! // add a scrollbar. ! wp->w_height = Rows - wp->w_winrow - extra_height; ! #ifdef FEAT_TERMINAL ! if (wp->w_buffer->b_term == NULL) ! #endif ! wp->w_has_scrollbar = TRUE; ! } ! ! // make sure w_winrow is valid if (wp->w_winrow >= Rows) wp->w_winrow = Rows - 1; else if (wp->w_winrow < 0) *** ../vim-8.2.1413/src/testdir/test_popupwin.vim 2020-08-09 16:36:45.870516749 +0200 --- src/testdir/test_popupwin.vim 2020-08-10 20:37:23.592127423 +0200 *************** *** 753,758 **** --- 753,759 ---- \ posinvert: 0, \ wrap: 0, \ fixed: 1, + \ scrollbar: v:false, \ zindex: 90, \ padding: [], \ highlight: 'PopupColor', *************** *** 772,777 **** --- 773,779 ---- \ posinvert: 0, \ wrap: 0, \ fixed: 1, + \ scrollbar: v:false, \ close: 'button', \ zindex: 90, \ padding: [], *************** *** 2169,2174 **** --- 2171,2181 ---- call term_sendkeys(buf, ":call ShowPopup()\") call VerifyScreenDump(buf, 'Test_popupwin_toohigh_2', {}) + call term_sendkeys(buf, ":call popup_clear()\") + call term_sendkeys(buf, "gg$") + call term_sendkeys(buf, ":call ShowPopup()\") + call VerifyScreenDump(buf, 'Test_popupwin_toohigh_3', {}) + " clean up call StopVimInTerminal(buf) call delete('XtestPopupToohigh') *** ../vim-8.2.1413/src/testdir/dumps/Test_popupwin_toohigh_3.dump 2020-08-10 20:38:39.487689682 +0200 --- src/testdir/dumps/Test_popupwin_toohigh_3.dump 2020-08-10 20:26:04.760534842 +0200 *************** *** 0 **** --- 1,10 ---- + |1+0&#ffffff0@8>1| @64 + |2@8|╔+0#0000001#ffd7ff255|═@8|╗| +0#0000000#ffffff0@54 + |3@8|║+0#0000001#ffd7ff255|o|n|e| @4| +0#0000000#0000001|║+0#0000001#ffd7ff255| +0#0000000#ffffff0@54 + |4@8|║+0#0000001#ffd7ff255|t|w|o| @4| +0#0000000#0000001|║+0#0000001#ffd7ff255| +0#0000000#ffffff0@54 + |5@8|║+0#0000001#ffd7ff255|t|h|r|e@1| @2| +0#0000000#0000001|║+0#0000001#ffd7ff255| +0#0000000#ffffff0@54 + |6@8|║+0#0000001#ffd7ff255|f|o|u|r| @3| +0#0000000#0000001|║+0#0000001#ffd7ff255| +0#0000000#ffffff0@54 + |7@8|║+0#0000001#ffd7ff255|f|i|v|e| @3| +0#0000000#a8a8a8255|║+0#0000001#ffd7ff255| +0#0000000#ffffff0@54 + |8@8|║+0#0000001#ffd7ff255|s|i|x| @4| +0#0000000#a8a8a8255|║+0#0000001#ffd7ff255| +0#0000000#ffffff0@54 + |9@8|║+0#0000001#ffd7ff255|s|e|v|e|n| @2| +0#0000000#a8a8a8255|║+0#0000001#ffd7ff255| +0#0000000#ffffff0@54 + |:|c|a|l@1| |S|h|o|╚+0#0000001#ffd7ff255|═@8|╝| +0#0000000#ffffff0@36|1|,|1|0| @9|T|o|p| *** ../vim-8.2.1413/src/testdir/dumps/Test_popupwin_nospace.dump 2019-11-10 17:45:49.000000000 +0100 --- src/testdir/dumps/Test_popupwin_nospace.dump 2020-08-10 20:34:02.377325122 +0200 *************** *** 3,12 **** |-|║+0#0000001#ffd7ff255|t|w|o|║|-+0#0000000#ffffff0@1|║+0#0000001#ffd7ff255|t|w|o|║|-+0#0000000#ffffff0@8|║+0#0000001#ffd7ff255|b@2|║|-+0#0000000#ffffff0@15|║+0#0000001#ffd7ff255|t|w|o|║|-+0#0000000#ffffff0@11| @14 |-|╚+0#0000001#ffd7ff255|═@2|╝|-+0#0000000#ffffff0@1|╚+0#0000001#ffd7ff255|═@2|╝|-+0#0000000#ffffff0@8|║+0#0000001#ffd7ff255|c@2|║|-+0#0000000#ffffff0@15|║+0#0000001#ffd7ff255|t|e@1|║|-+0#0000000#ffffff0@11| @14 |-|@|-@5|#|-@5|%|-@5|║+0#0000001#ffd7ff255|d@2|║|-+0#0000000#ffffff0@15|║+0#0000001#ffd7ff255|f|o|u|║|-+0#0000000#ffffff0@1>*|-@8| @14 ! |-@14|╔+0#0000001#ffd7ff255|═@2|╗|-+0#0000000#ffffff0@1|║+0#0000001#ffd7ff255|e@2|║|-+0#0000000#ffffff0@15|║+0#0000001#ffd7ff255|f|i|v|║|-+0#0000000#ffffff0@1|╔+0#0000001#ffd7ff255|═@2|╗|-+0#0000000#ffffff0@4| @14 ! |-@14|║+0#0000001#ffd7ff255|o|n|e|║|-+0#0000000#ffffff0@1|╚+0#0000001#ffd7ff255|═@2|╝|-+0#0000000#ffffff0@15|╚+0#0000001#ffd7ff255|═@2|╝|-+0#0000000#ffffff0@1|║+0#0000001#ffd7ff255|a@2|║|-+0#0000000#ffffff0@4| @14 ! |-@14|║+0#0000001#ffd7ff255|t|w|o|║|-+0#0000000#ffffff0@1|*|-@5|@|-@5|#|-@5|%|-@5|║+0#0000001#ffd7ff255|b@2|║|-+0#0000000#ffffff0@4| @14 ! |-@14|║+0#0000001#ffd7ff255|t|e@1|║|-+0#0000000#ffffff0@8|╔+0#0000001#ffd7ff255|═@2|╗|-+0#0000000#ffffff0@1|╔+0#0000001#ffd7ff255|═@2|╗|-+0#0000000#ffffff0@8|║+0#0000001#ffd7ff255|c@2|║|-+0#0000000#ffffff0@4| @14 ! |-@14|╚+0#0000001#ffd7ff255|═@2|╝|-+0#0000000#ffffff0@8|║+0#0000001#ffd7ff255|o|n|e|║|-+0#0000000#ffffff0@1|║+0#0000001#ffd7ff255|o|n|e|║|-+0#0000000#ffffff0@8|║+0#0000001#ffd7ff255|d@2|║|-+0#0000000#ffffff0@4| @14 ! |-@28|║+0#0000001#ffd7ff255|t|w|o|║|-+0#0000000#ffffff0@1|║+0#0000001#ffd7ff255|t|w|o|║|-+0#0000000#ffffff0@8|║+0#0000001#ffd7ff255|e@2|║|-+0#0000000#ffffff0@4| @14 ! @29|╚+0#0000001#ffd7ff255|═@2|╝| +0#0000000#ffffff0@1|║+0#0000001#ffd7ff255|t|e@1|║| +0#0000000#ffffff0@8|║+0#0000001#ffd7ff255|f@2|║| +0#0000000#ffffff0@1|5|,|5|1| @9|T|o|p| --- 3,12 ---- |-|║+0#0000001#ffd7ff255|t|w|o|║|-+0#0000000#ffffff0@1|║+0#0000001#ffd7ff255|t|w|o|║|-+0#0000000#ffffff0@8|║+0#0000001#ffd7ff255|b@2|║|-+0#0000000#ffffff0@15|║+0#0000001#ffd7ff255|t|w|o|║|-+0#0000000#ffffff0@11| @14 |-|╚+0#0000001#ffd7ff255|═@2|╝|-+0#0000000#ffffff0@1|╚+0#0000001#ffd7ff255|═@2|╝|-+0#0000000#ffffff0@8|║+0#0000001#ffd7ff255|c@2|║|-+0#0000000#ffffff0@15|║+0#0000001#ffd7ff255|t|e@1|║|-+0#0000000#ffffff0@11| @14 |-|@|-@5|#|-@5|%|-@5|║+0#0000001#ffd7ff255|d@2|║|-+0#0000000#ffffff0@15|║+0#0000001#ffd7ff255|f|o|u|║|-+0#0000000#ffffff0@1>*|-@8| @14 ! |-@14|╔+0#0000001#ffd7ff255|═@2|╗|-+0#0000000#ffffff0@1|║+0#0000001#ffd7ff255|e@2|║|-+0#0000000#ffffff0@15|║+0#0000001#ffd7ff255|f|i|v|║|-+0#0000000#ffffff0@1|╔+0#0000001#ffd7ff255|═@3|╗|-+0#0000000#ffffff0@3| @14 ! |-@14|║+0#0000001#ffd7ff255|o|n|e|║|-+0#0000000#ffffff0@1|╚+0#0000001#ffd7ff255|═@2|╝|-+0#0000000#ffffff0@15|╚+0#0000001#ffd7ff255|═@2|╝|-+0#0000000#ffffff0@1|║+0#0000001#ffd7ff255|a@2| +0#0000000#0000001|║+0#0000001#ffd7ff255|-+0#0000000#ffffff0@3| @14 ! |-@14|║+0#0000001#ffd7ff255|t|w|o|║|-+0#0000000#ffffff0@1|*|-@5|@|-@5|#|-@5|%|-@5|║+0#0000001#ffd7ff255|b@2| +0#0000000#0000001|║+0#0000001#ffd7ff255|-+0#0000000#ffffff0@3| @14 ! |-@14|║+0#0000001#ffd7ff255|t|e@1|║|-+0#0000000#ffffff0@8|╔+0#0000001#ffd7ff255|═@2|╗|-+0#0000000#ffffff0@1|╔+0#0000001#ffd7ff255|═@3|╗|-+0#0000000#ffffff0@7|║+0#0000001#ffd7ff255|c@2| +0#0000000#0000001|║+0#0000001#ffd7ff255|-+0#0000000#ffffff0@3| @14 ! |-@14|╚+0#0000001#ffd7ff255|═@2|╝|-+0#0000000#ffffff0@8|║+0#0000001#ffd7ff255|o|n|e|║|-+0#0000000#ffffff0@1|║+0#0000001#ffd7ff255|o|n|e| +0#0000000#0000001|║+0#0000001#ffd7ff255|-+0#0000000#ffffff0@7|║+0#0000001#ffd7ff255|d@2| +0#0000000#0000001|║+0#0000001#ffd7ff255|-+0#0000000#ffffff0@3| @14 ! |-@28|║+0#0000001#ffd7ff255|t|w|o|║|-+0#0000000#ffffff0@1|║+0#0000001#ffd7ff255|t|w|o| +0#0000000#a8a8a8255|║+0#0000001#ffd7ff255|-+0#0000000#ffffff0@7|║+0#0000001#ffd7ff255|e@2| +0#0000000#a8a8a8255|║+0#0000001#ffd7ff255|-+0#0000000#ffffff0@3| @14 ! @29|╚+0#0000001#ffd7ff255|═@2|╝| +0#0000000#ffffff0@1|╚+0#0000001#ffd7ff255|═@3|╝| +0#0000000#ffffff0@7|╚+0#0000001#ffd7ff255|═@3|╝| +0#0000000#ffffff0|5|,|5|1| @9|T|o|p| *** ../vim-8.2.1413/src/version.c 2020-08-10 19:21:12.163749066 +0200 --- src/version.c 2020-08-10 20:24:47.993128467 +0200 *************** *** 756,757 **** --- 756,759 ---- { /* Add new patch number below this line */ + /**/ + 1414, /**/ -- An error has occurred. Hit any user to continue. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///