Blame SOURCES/7.4.352

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