073263
To: vim_dev@googlegroups.com
073263
Subject: Patch 7.4.352
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.352
073263
Problem:    With 'linebreak' a tab causes missing line break.
073263
Solution:   Count a tab for what it's worth also for shorter lines.
073263
	    (Christian Brabandt)
073263
Files:	    src/charset.c
073263
073263
073263
*** ../vim-7.4.351/src/charset.c	2014-06-25 14:39:35.098348584 +0200
073263
--- src/charset.c	2014-07-02 19:34:28.142352040 +0200
073263
***************
073263
*** 1078,1083 ****
073263
--- 1078,1084 ----
073263
      int		c;
073263
      int		size;
073263
      colnr_T	col2;
073263
+     colnr_T	col_adj = 0; /* col + screen size of tab */
073263
      colnr_T	colmax;
073263
      int		added;
073263
  # ifdef FEAT_MBYTE
073263
***************
073263
*** 1109,1114 ****
073263
--- 1110,1117 ----
073263
       */
073263
      size = win_chartabsize(wp, s, col);
073263
      c = *s;
073263
+     if (tab_corr)
073263
+ 	col_adj = size - 1;
073263
  
073263
      /*
073263
       * If 'linebreak' set check at a blank before a non-blank if the line
073263
***************
073263
*** 1130,1141 ****
073263
  	 */
073263
  	numberextra = win_col_off(wp);
073263
  	col2 = col;
073263
! 	colmax = (colnr_T)(W_WIDTH(wp) - numberextra);
073263
  	if (col >= colmax)
073263
  	{
073263
! 	    n = colmax + win_col_off2(wp);
073263
  	    if (n > 0)
073263
! 		colmax += (((col - colmax) / n) + 1) * n;
073263
  	}
073263
  
073263
  	for (;;)
073263
--- 1133,1145 ----
073263
  	 */
073263
  	numberextra = win_col_off(wp);
073263
  	col2 = col;
073263
! 	colmax = (colnr_T)(W_WIDTH(wp) - numberextra - col_adj);
073263
  	if (col >= colmax)
073263
  	{
073263
! 	    colmax += col_adj;
073263
! 	    n = colmax +  win_col_off2(wp);
073263
  	    if (n > 0)
073263
! 		colmax += (((col - colmax) / n) + 1) * n - col_adj;
073263
  	}
073263
  
073263
  	for (;;)
073263
***************
073263
*** 1152,1158 ****
073263
  	    col2 += win_chartabsize(wp, s, col2);
073263
  	    if (col2 >= colmax)		/* doesn't fit */
073263
  	    {
073263
! 		size = colmax - col;
073263
  		tab_corr = FALSE;
073263
  		break;
073263
  	    }
073263
--- 1156,1162 ----
073263
  	    col2 += win_chartabsize(wp, s, col2);
073263
  	    if (col2 >= colmax)		/* doesn't fit */
073263
  	    {
073263
! 		size = colmax - col + col_adj;
073263
  		tab_corr = FALSE;
073263
  		break;
073263
  	    }
073263
*** ../vim-7.4.351/src/version.c	2014-07-02 19:06:14.686326091 +0200
073263
--- src/version.c	2014-07-02 19:32:50.218350540 +0200
073263
***************
073263
*** 736,737 ****
073263
--- 736,739 ----
073263
  {   /* Add new patch number below this line */
073263
+ /**/
073263
+     352,
073263
  /**/
073263
073263
-- 
073263
The early bird gets the worm. The second mouse gets the cheese.
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    ///