]> granicus.if.org Git - vim/commitdiff
patch 8.2.2132: padding not drawn properly for popup window with title v8.2.2132
authorBram Moolenaar <Bram@vim.org>
Sat, 12 Dec 2020 17:18:06 +0000 (18:18 +0100)
committerBram Moolenaar <Bram@vim.org>
Sat, 12 Dec 2020 17:18:06 +0000 (18:18 +0100)
Problem:    Padding not drawn properly for popup window with title.
Solution:   Draw the padding below the title. (closes #7460)

src/popupwin.c
src/testdir/dumps/Test_popupwin_longtitle_3.dump [new file with mode: 0644]
src/testdir/dumps/Test_popupwin_longtitle_4.dump [new file with mode: 0644]
src/testdir/test_popupwin.vim
src/version.c

index cfd2050d3a4015c3565fd1cd5523bf657bfab93d..13a455d4ecc7cb92507ae52eda2ce14a03f3d1b5 100644 (file)
@@ -3868,20 +3868,19 @@ update_popups(void (*win_update)(win_T *wp))
        }
        if (top_padding > 0)
        {
-           // top padding; do not draw over the title
            row = wp->w_winrow + wp->w_popup_border[0];
-           if (title_len > 0)
+           if (title_len > 0 && row == wp->w_winrow)
            {
-               screen_fill(row, row + top_padding, padcol, title_wincol,
+               // top padding and no border; do not draw over the title
+               screen_fill(row, row + 1, padcol, title_wincol,
                                                         ' ', ' ', popup_attr);
-               screen_fill(row, row + top_padding, title_wincol + title_len,
+               screen_fill(row, row + 1, title_wincol + title_len,
                                              padendcol, ' ', ' ', popup_attr);
+               row += 1;
+               top_padding -= 1;
            }
-           else
-           {
-               screen_fill(row, row + top_padding, padcol, padendcol,
+           screen_fill(row, row + top_padding, padcol, padendcol,
                                                         ' ', ' ', popup_attr);
-           }
        }
 
        // Compute scrollbar thumb position and size.
diff --git a/src/testdir/dumps/Test_popupwin_longtitle_3.dump b/src/testdir/dumps/Test_popupwin_longtitle_3.dump
new file mode 100644 (file)
index 0000000..b1e67c2
--- /dev/null
@@ -0,0 +1,10 @@
+>1+0&#ffffff0| @73
+|2| @73
+|3| @27| +0#0000001#ffd7ff255|T|i|t|l|e| @9| +0#0000000#ffffff0@29
+|4| @27| +0#0000001#ffd7ff255@15| +0#0000000#ffffff0@29
+|5| @27| +0#0000001#ffd7ff255@1|a@2| @10| +0#0000000#ffffff0@29
+|6| @27| +0#0000001#ffd7ff255@1|b@2| @10| +0#0000000#ffffff0@29
+|7| @27| +0#0000001#ffd7ff255@15| +0#0000000#ffffff0@29
+|8| @27| +0#0000001#ffd7ff255@15| +0#0000000#ffffff0@29
+|9| @73
+|:| @55|1|,|1| @10|T|o|p| 
diff --git a/src/testdir/dumps/Test_popupwin_longtitle_4.dump b/src/testdir/dumps/Test_popupwin_longtitle_4.dump
new file mode 100644 (file)
index 0000000..02ae4cc
--- /dev/null
@@ -0,0 +1,10 @@
+>1+0&#ffffff0| @73
+|2| @26|╔+0#0000001#ffd7ff255|T|i|t|l|e|═@10|╗| +0#0000000#ffffff0@28
+|3| @26|║+0#0000001#ffd7ff255| @15|║| +0#0000000#ffffff0@28
+|4| @26|║+0#0000001#ffd7ff255| @15|║| +0#0000000#ffffff0@28
+|5| @26|║+0#0000001#ffd7ff255| @1|a@2| @10|║| +0#0000000#ffffff0@28
+|6| @26|║+0#0000001#ffd7ff255| @1|b@2| @10|║| +0#0000000#ffffff0@28
+|7| @26|║+0#0000001#ffd7ff255| @15|║| +0#0000000#ffffff0@28
+|8| @26|║+0#0000001#ffd7ff255| @15|║| +0#0000000#ffffff0@28
+|9| @26|╚+0#0000001#ffd7ff255|═@15|╝| +0#0000000#ffffff0@28
+|:| @55|1|,|1| @10|T|o|p| 
index 3f13b26a11d29ca63a038bc8edc15310e2ebc4f4..cf9536f5e1fb42f1f53cfdc771a9143da0dae37b 100644 (file)
@@ -1766,6 +1766,16 @@ func Test_popup_title()
   call term_sendkeys(buf, ":\<CR>")
   call VerifyScreenDump(buf, 'Test_popupwin_longtitle_2', {})
 
+  call term_sendkeys(buf, ":call popup_clear()\<CR>")
+  call term_sendkeys(buf, ":call popup_create(['aaa', 'bbb'], #{title: 'Title', minwidth: 12, padding: [2, 2, 2, 2]})\<CR>")
+  call term_sendkeys(buf, ":\<CR>")
+  call VerifyScreenDump(buf, 'Test_popupwin_longtitle_3', {})
+
+  call term_sendkeys(buf, ":call popup_clear()\<CR>")
+  call term_sendkeys(buf, ":call popup_create(['aaa', 'bbb'], #{title: 'Title', minwidth: 12, border: [], padding: [2, 2, 2, 2]})\<CR>")
+  call term_sendkeys(buf, ":\<CR>")
+  call VerifyScreenDump(buf, 'Test_popupwin_longtitle_4', {})
+
   " clean up
   call StopVimInTerminal(buf)
   call delete('XtestPopupTitle')
index e4c3c6721bfa5be9b9c88ca1b5cd5d4c6d2a9444..5bc5f553502ebe37eac913f9bff4ebdf5e039af7 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2132,
 /**/
     2131,
 /**/