073263
To: vim_dev@googlegroups.com
073263
Subject: Patch 7.4.587
073263
Fcc: outbox
073263
From: Bram Moolenaar <Bram@moolenaar.net>
073263
Mime-Version: 1.0
073263
Content-Type: text/plain; charset=UTF-8
073263
Content-Transfer-Encoding: 8bit
073263
------------
073263
073263
Patch 7.4.587
073263
Problem:    Conceal does not work properly with 'linebreak'. (cs86661)
073263
Solution:   Save and restore boguscols. (Christian Brabandt)
073263
Files:	    src/screen.c, src/testdir/test_listlbr_utf8.in,
073263
	    src/testdir/test_listlbr_utf8.ok
073263
073263
073263
*** ../vim-7.4.586/src/screen.c	2015-01-14 19:35:10.967756099 +0100
073263
--- src/screen.c	2015-01-20 18:57:39.114986010 +0100
073263
***************
073263
*** 3003,3008 ****
073263
--- 3003,3009 ----
073263
  					   wrapping */
073263
      int		vcol_off	= 0;	/* offset for concealed characters */
073263
      int		did_wcol	= FALSE;
073263
+     int		old_boguscols   = 0;
073263
  # define VCOL_HLC (vcol - vcol_off)
073263
  # define FIX_FOR_BOGUSCOLS \
073263
      { \
073263
***************
073263
*** 3010,3015 ****
073263
--- 3011,3017 ----
073263
  	vcol -= vcol_off; \
073263
  	vcol_off = 0; \
073263
  	col -= boguscols; \
073263
+ 	old_boguscols = boguscols; \
073263
  	boguscols = 0; \
073263
      }
073263
  #else
073263
***************
073263
*** 4545,4554 ****
073263
  			int	saved_nextra = n_extra;
073263
  
073263
  #ifdef FEAT_CONCEAL
073263
! 			if (is_concealing && vcol_off > 0)
073263
  			    /* there are characters to conceal */
073263
  			    tab_len += vcol_off;
073263
  #endif
073263
  			/* if n_extra > 0, it gives the number of chars, to
073263
  			 * use for a tab, else we need to calculate the width
073263
  			 * for a tab */
073263
--- 4547,4562 ----
073263
  			int	saved_nextra = n_extra;
073263
  
073263
  #ifdef FEAT_CONCEAL
073263
! 			if ((is_concealing || boguscols > 0) && vcol_off > 0)
073263
  			    /* there are characters to conceal */
073263
  			    tab_len += vcol_off;
073263
+ 			/* boguscols before FIX_FOR_BOGUSCOLS macro from above
073263
+ 			 */
073263
+ 			if (wp->w_p_list && lcs_tab1 && old_boguscols > 0
073263
+ 							 && n_extra > tab_len)
073263
+ 			    tab_len += n_extra - tab_len;
073263
  #endif
073263
+ 
073263
  			/* if n_extra > 0, it gives the number of chars, to
073263
  			 * use for a tab, else we need to calculate the width
073263
  			 * for a tab */
073263
***************
073263
*** 4577,4583 ****
073263
  #ifdef FEAT_CONCEAL
073263
  			/* n_extra will be increased by FIX_FOX_BOGUSCOLS
073263
  			 * macro below, so need to adjust for that here */
073263
! 			if (is_concealing && vcol_off > 0)
073263
  			    n_extra -= vcol_off;
073263
  #endif
073263
  		    }
073263
--- 4585,4591 ----
073263
  #ifdef FEAT_CONCEAL
073263
  			/* n_extra will be increased by FIX_FOX_BOGUSCOLS
073263
  			 * macro below, so need to adjust for that here */
073263
! 			if ((is_concealing || boguscols > 0) && vcol_off > 0)
073263
  			    n_extra -= vcol_off;
073263
  #endif
073263
  		    }
073263
***************
073263
*** 4590,4595 ****
073263
--- 4598,4609 ----
073263
  		     * the tab can be longer than 'tabstop' when there
073263
  		     * are concealed characters. */
073263
  		    FIX_FOR_BOGUSCOLS;
073263
+ 		    /* Make sure, the highlighting for the tab char will be
073263
+ 		     * correctly set further below (effectively reverts the
073263
+ 		     * FIX_FOR_BOGSUCOLS macro */
073263
+ 		    if (old_boguscols > 0 && n_extra > tab_len && wp->w_p_list
073263
+ 								  && lcs_tab1)
073263
+ 			tab_len += n_extra - tab_len;
073263
  #endif
073263
  #ifdef FEAT_MBYTE
073263
  		    mb_utf8 = FALSE;	/* don't draw as UTF-8 */
073263
*** ../vim-7.4.586/src/testdir/test_listlbr_utf8.in	2014-07-30 16:44:17.499534723 +0200
073263
--- src/testdir/test_listlbr_utf8.in	2015-01-20 18:55:32.060370459 +0100
073263
***************
073263
*** 9,17 ****
073263
  :put =\"\tabcdef hijklmn\tpqrstuvwxyz\u00a01060ABCDEFGHIJKLMNOP \"
073263
  :norm! zt
073263
  :set ts=4 sw=4 sts=4 linebreak sbr=+ wrap
073263
! :fu! ScreenChar(width)
073263
  :	let c=''
073263
! :	for j in range(1,4)
073263
  :	    for i in range(1,a:width)
073263
  :	    	let c.=nr2char(screenchar(j, i))
073263
  :	    endfor
073263
--- 9,17 ----
073263
  :put =\"\tabcdef hijklmn\tpqrstuvwxyz\u00a01060ABCDEFGHIJKLMNOP \"
073263
  :norm! zt
073263
  :set ts=4 sw=4 sts=4 linebreak sbr=+ wrap
073263
! :fu! ScreenChar(width, lines)
073263
  :	let c=''
073263
! :	for j in range(1,a:lines)
073263
  :	    for i in range(1,a:width)
073263
  :	    	let c.=nr2char(screenchar(j, i))
073263
  :	    endfor
073263
***************
073263
*** 28,40 ****
073263
  :let g:test ="Test 1: set linebreak + set list + fancy listchars"
073263
  :exe "set linebreak list listchars=nbsp:\u2423,tab:\u2595\u2014,trail:\u02d1,eol:\ub6"
073263
  :redraw!
073263
! :let line=ScreenChar(winwidth(0))
073263
  :call DoRecordScreen()
073263
  :"
073263
  :let g:test ="Test 2: set nolinebreak list"
073263
  :set list nolinebreak
073263
  :redraw!
073263
! :let line=ScreenChar(winwidth(0))
073263
  :call DoRecordScreen()
073263
  :"
073263
  :let g:test ="Test 3: set linebreak nolist"
073263
--- 28,40 ----
073263
  :let g:test ="Test 1: set linebreak + set list + fancy listchars"
073263
  :exe "set linebreak list listchars=nbsp:\u2423,tab:\u2595\u2014,trail:\u02d1,eol:\ub6"
073263
  :redraw!
073263
! :let line=ScreenChar(winwidth(0),4)
073263
  :call DoRecordScreen()
073263
  :"
073263
  :let g:test ="Test 2: set nolinebreak list"
073263
  :set list nolinebreak
073263
  :redraw!
073263
! :let line=ScreenChar(winwidth(0),4)
073263
  :call DoRecordScreen()
073263
  :"
073263
  :let g:test ="Test 3: set linebreak nolist"
073263
***************
073263
*** 43,51 ****
073263
  :norm! zt
073263
  :set nolist linebreak
073263
  :redraw!
073263
! :let line=ScreenChar(winwidth(0))
073263
  :call DoRecordScreen()
073263
- :"
073263
  :%w! test.out
073263
  :qa!
073263
  ENDTEST
073263
--- 43,61 ----
073263
  :norm! zt
073263
  :set nolist linebreak
073263
  :redraw!
073263
! :let line=ScreenChar(winwidth(0),4)
073263
! :call DoRecordScreen()
073263
! :let g:test ="Test 4: set linebreak list listchars and concealing"
073263
! :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']
073263
! :call append('$', c_defines)
073263
! :vert resize 40
073263
! :$-7
073263
! :norm! zt
073263
! :set list linebreak listchars=tab:>- cole=1
073263
! :syn match Conceal conceal cchar=>'AB\|MSG_MODE'
073263
! :redraw!
073263
! :let line=ScreenChar(winwidth(0),7)
073263
  :call DoRecordScreen()
073263
  :%w! test.out
073263
  :qa!
073263
  ENDTEST
073263
*** ../vim-7.4.586/src/testdir/test_listlbr_utf8.ok	2014-07-30 16:44:17.499534723 +0200
073263
--- src/testdir/test_listlbr_utf8.ok	2015-01-20 18:55:32.060370459 +0100
073263
***************
073263
*** 19,21 ****
073263
--- 19,38 ----
073263
  ~                   
073263
  ~                   
073263
  ~                   
073263
+ #define ABCDE		1
073263
+ #define ABCDEF		1
073263
+ #define ABCDEFG		1
073263
+ #define ABCDEFGH	1
073263
+ #define MSG_MODE_FILE			1
073263
+ #define MSG_MODE_CONSOLE		2
073263
+ #define MSG_MODE_FILE_AND_CONSOLE	3
073263
+ #define MSG_MODE_FILE_THEN_CONSOLE	4
073263
+ 
073263
+ Test 4: set linebreak list listchars and concealing
073263
+ #define ABCDE>-->---1                   
073263
+ #define >CDEF>-->---1                   
073263
+ #define >CDEFG>->---1                   
073263
+ #define >CDEFGH>----1                   
073263
+ #define >_FILE>--------->--->---1       
073263
+ #define >_CONSOLE>---------->---2       
073263
+ #define >_FILE_AND_CONSOLE>---------3   
073263
*** ../vim-7.4.586/src/version.c	2015-01-20 17:27:18.154026317 +0100
073263
--- src/version.c	2015-01-20 19:01:11.448672365 +0100
073263
***************
073263
*** 743,744 ****
073263
--- 743,746 ----
073263
  {   /* Add new patch number below this line */
073263
+ /**/
073263
+     587,
073263
  /**/
073263
073263
-- 
073263
hundred-and-one symptoms of being an internet addict:
073263
93. New mail alarm on your palmtop annoys other churchgoers.
073263
073263
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
073263
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
073263
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
073263
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///