]> granicus.if.org Git - vim/commitdiff
updated for version 7.4.587 v7.4.587
authorBram Moolenaar <Bram@vim.org>
Tue, 20 Jan 2015 18:01:35 +0000 (19:01 +0100)
committerBram Moolenaar <Bram@vim.org>
Tue, 20 Jan 2015 18:01:35 +0000 (19:01 +0100)
Problem:    Conceal does not work properly with 'linebreak'. (cs86661)
Solution:   Save and restore boguscols. (Christian Brabandt)

src/screen.c
src/testdir/test_listlbr_utf8.in
src/testdir/test_listlbr_utf8.ok
src/version.c

index b767ec3c15ab029d3ec210639114eabfe6703e97..698f969687cd40615cdd94a681667acd3fe79a6a 100644 (file)
@@ -3003,6 +3003,7 @@ win_line(wp, lnum, startrow, endrow, nochange)
                                           wrapping */
     int                vcol_off        = 0;    /* offset for concealed characters */
     int                did_wcol        = FALSE;
+    int                old_boguscols   = 0;
 # define VCOL_HLC (vcol - vcol_off)
 # define FIX_FOR_BOGUSCOLS \
     { \
@@ -3010,6 +3011,7 @@ win_line(wp, lnum, startrow, endrow, nochange)
        vcol -= vcol_off; \
        vcol_off = 0; \
        col -= boguscols; \
+       old_boguscols = boguscols; \
        boguscols = 0; \
     }
 #else
@@ -4545,10 +4547,16 @@ win_line(wp, lnum, startrow, endrow, nochange)
                        int     saved_nextra = n_extra;
 
 #ifdef FEAT_CONCEAL
-                       if (is_concealing && vcol_off > 0)
+                       if ((is_concealing || boguscols > 0) && vcol_off > 0)
                            /* there are characters to conceal */
                            tab_len += vcol_off;
+                       /* boguscols before FIX_FOR_BOGUSCOLS macro from above
+                        */
+                       if (wp->w_p_list && lcs_tab1 && old_boguscols > 0
+                                                        && n_extra > tab_len)
+                           tab_len += n_extra - tab_len;
 #endif
+
                        /* if n_extra > 0, it gives the number of chars, to
                         * use for a tab, else we need to calculate the width
                         * for a tab */
@@ -4577,7 +4585,7 @@ win_line(wp, lnum, startrow, endrow, nochange)
 #ifdef FEAT_CONCEAL
                        /* n_extra will be increased by FIX_FOX_BOGUSCOLS
                         * macro below, so need to adjust for that here */
-                       if (is_concealing && vcol_off > 0)
+                       if ((is_concealing || boguscols > 0) && vcol_off > 0)
                            n_extra -= vcol_off;
 #endif
                    }
@@ -4590,6 +4598,12 @@ win_line(wp, lnum, startrow, endrow, nochange)
                     * the tab can be longer than 'tabstop' when there
                     * are concealed characters. */
                    FIX_FOR_BOGUSCOLS;
+                   /* Make sure, the highlighting for the tab char will be
+                    * correctly set further below (effectively reverts the
+                    * FIX_FOR_BOGSUCOLS macro */
+                   if (old_boguscols > 0 && n_extra > tab_len && wp->w_p_list
+                                                                 && lcs_tab1)
+                       tab_len += n_extra - tab_len;
 #endif
 #ifdef FEAT_MBYTE
                    mb_utf8 = FALSE;    /* don't draw as UTF-8 */
index ba12adae05e52219b76add4cc5a90b96fabaf708..b3d05dfaed06f7871580108943b204358887cb0c 100644 (file)
@@ -9,9 +9,9 @@ STARTTEST
 :put =\"\tabcdef hijklmn\tpqrstuvwxyz\u00a01060ABCDEFGHIJKLMNOP \"
 :norm! zt
 :set ts=4 sw=4 sts=4 linebreak sbr=+ wrap
-:fu! ScreenChar(width)
+:fu! ScreenChar(width, lines)
 :      let c=''
-:      for j in range(1,4)
+:      for j in range(1,a:lines)
 :          for i in range(1,a:width)
 :              let c.=nr2char(screenchar(j, i))
 :          endfor
@@ -28,13 +28,13 @@ STARTTEST
 :let g:test ="Test 1: set linebreak + set list + fancy listchars"
 :exe "set linebreak list listchars=nbsp:\u2423,tab:\u2595\u2014,trail:\u02d1,eol:\ub6"
 :redraw!
-:let line=ScreenChar(winwidth(0))
+:let line=ScreenChar(winwidth(0),4)
 :call DoRecordScreen()
 :"
 :let g:test ="Test 2: set nolinebreak list"
 :set list nolinebreak
 :redraw!
-:let line=ScreenChar(winwidth(0))
+:let line=ScreenChar(winwidth(0),4)
 :call DoRecordScreen()
 :"
 :let g:test ="Test 3: set linebreak nolist"
@@ -43,9 +43,19 @@ STARTTEST
 :norm! zt
 :set nolist linebreak
 :redraw!
-:let line=ScreenChar(winwidth(0))
+:let line=ScreenChar(winwidth(0),4)
+:call DoRecordScreen()
+:let g:test ="Test 4: set linebreak list listchars and concealing"
+:let c_defines=['#define ABCDE         1','#define ABCDEF              1','#define ABCDEFG             1','#define ABCDEFGH    1', '#define MSG_MODE_FILE                      1','#define MSG_MODE_CONSOLE            2','#define MSG_MODE_FILE_AND_CONSOLE   3','#define MSG_MODE_FILE_THEN_CONSOLE  4']
+:call append('$', c_defines)
+:vert resize 40
+:$-7
+:norm! zt
+:set list linebreak listchars=tab:>- cole=1
+:syn match Conceal conceal cchar=>'AB\|MSG_MODE'
+:redraw!
+:let line=ScreenChar(winwidth(0),7)
 :call DoRecordScreen()
-:"
 :%w! test.out
 :qa!
 ENDTEST
index 634cf3906dc4602bd6c155cb69942ad2e6625ad5..b90e6969721c4598f330c60b499179db12e2e808 100644 (file)
@@ -19,3 +19,20 @@ Test 3: set linebreak nolist
 ~                   
 ~                   
 ~                   
+#define ABCDE          1
+#define ABCDEF         1
+#define ABCDEFG                1
+#define ABCDEFGH       1
+#define MSG_MODE_FILE                  1
+#define MSG_MODE_CONSOLE               2
+#define MSG_MODE_FILE_AND_CONSOLE      3
+#define MSG_MODE_FILE_THEN_CONSOLE     4
+
+Test 4: set linebreak list listchars and concealing
+#define ABCDE>-->---1                   
+#define >CDEF>-->---1                   
+#define >CDEFG>->---1                   
+#define >CDEFGH>----1                   
+#define >_FILE>--------->--->---1       
+#define >_CONSOLE>---------->---2       
+#define >_FILE_AND_CONSOLE>---------3   
index d43e4c1ca5b6402c5c6ac2437b686ba8d8a44564..9cbee6e69a18dd8bef3f892a36418a779a36f685 100644 (file)
@@ -741,6 +741,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    587,
 /**/
     586,
 /**/