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