]> granicus.if.org Git - vim/commitdiff
patch 8.1.1656: popup window width is wrong when using Tabs v8.1.1656
authorBram Moolenaar <Bram@vim.org>
Tue, 9 Jul 2019 18:25:25 +0000 (20:25 +0200)
committerBram Moolenaar <Bram@vim.org>
Tue, 9 Jul 2019 18:25:25 +0000 (20:25 +0200)
Problem:    Popup window width is wrong when using Tabs. (Paul Jolly)
Solution:   Count tabs correctly. (closes #4637)

src/popupwin.c
src/testdir/dumps/Test_popupwin_11.dump
src/testdir/test_popupwin.vim
src/version.c

index 32f486181e2c595aa18f0fafc962108c04e1c4b6..a997cde87dea53be60cdcf0b1f7cab0660eece9f 100644 (file)
@@ -880,7 +880,9 @@ popup_adjust_position(win_T *wp)
     wp->w_width = 1;
     for (lnum = wp->w_topline; lnum <= wp->w_buffer->b_ml.ml_line_count; ++lnum)
     {
-       int len = vim_strsize(ml_get_buf(wp->w_buffer, lnum, FALSE));
+       // count Tabs for what they are worth
+       int len = win_linetabsize(wp, ml_get_buf(wp->w_buffer, lnum, FALSE),
+                                                             (colnr_T)MAXCOL);
 
        if (wp->w_p_wrap)
        {
index 21460ddb84491c1344a00501b3bcf42b48f137f8..f67a3146454e7f2dfba08e6045cb543fca332890 100644 (file)
@@ -1,10 +1,10 @@
 >1+0&#ffffff0| @73
 |2| @73
-|3| @18|#+0#e000e06#e0e0e08|i|n|c|l|u|d|e| |<+0#e000002&|s|t|d|i|o|.|h|>| +0#0000000#ffffff0@36
-|4| @18|i+0#00e0003#e0e0e08|n|t| +0#0000000&|m|a|i|n|(|v+0#00e0003&|o|i|d|)+0#0000000&| @3| +0&#ffffff0@36
-|5| @18|{+0&#e0e0e08| @16| +0&#ffffff0@36
-|6| @18| +0&#e0e0e08@3|p|r|i|n|t|f|(|5+0#e000002&|6|7|)+0#0000000&|;| @1| +0&#ffffff0@36
-|7| @18|}+0&#e0e0e08| @16| +0&#ffffff0@36
+|3| @18|#+0#e000e06#e0e0e08|i|n|c|l|u|d|e| |<+0#e000002&|s|t|d|i|o|.|h|>| +0#0000000&@1| +0&#ffffff0@34
+|4| @18|i+0#00e0003#e0e0e08|n|t| +0#0000000&|m|a|i|n|(|v+0#00e0003&|o|i|d|)+0#0000000&| @5| +0&#ffffff0@34
+|5| @18|{+0&#e0e0e08| @18| +0&#ffffff0@34
+|6| @18| +0&#e0e0e08@7|p|r|i|n|t|f|(|5+0#e000002&|6|7|)+0#0000000&|;| +0&#ffffff0@34
+|7| @18|}+0&#e0e0e08| @18| +0&#ffffff0@34
 |8| @73
 |9| @73
 @57|1|,|1| @10|T|o|p| 
index 0ec4f7600458eb99242a918ea163c79daeaff1bf..4e3170ce3a722a7b9f07806ebc00655e8fb75de5 100644 (file)
@@ -225,7 +225,7 @@ func Test_popup_with_syntax_setbufvar()
            \ '#include <stdio.h>',
            \ 'int main(void)',
            \ '{',
-           \ '    printf(567);',
+           \ "\tprintf(567);",
            \ '}',
            \], {'line': 3, 'col': 21, 'highlight': 'PopupColor'})
        call setbufvar(winbufnr(winid), '&syntax', 'cpp')
index 62b95579dc7ae386360db0568b13d623619a4b82..c58cbc588fb462c92ee39140b249a101ff46c425 100644 (file)
@@ -777,6 +777,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1656,
 /**/
     1655,
 /**/