Blame SOURCES/7.4.587

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