3ef2ca
To: vim_dev@googlegroups.com
3ef2ca
Subject: Patch 7.4.352
3ef2ca
Fcc: outbox
3ef2ca
From: Bram Moolenaar <Bram@moolenaar.net>
3ef2ca
Mime-Version: 1.0
3ef2ca
Content-Type: text/plain; charset=UTF-8
3ef2ca
Content-Transfer-Encoding: 8bit
3ef2ca
------------
3ef2ca
3ef2ca
Patch 7.4.352
3ef2ca
Problem:    With 'linebreak' a tab causes missing line break.
3ef2ca
Solution:   Count a tab for what it's worth also for shorter lines.
3ef2ca
	    (Christian Brabandt)
3ef2ca
Files:	    src/charset.c
3ef2ca
3ef2ca
3ef2ca
*** ../vim-7.4.351/src/charset.c	2014-06-25 14:39:35.098348584 +0200
3ef2ca
--- src/charset.c	2014-07-02 19:34:28.142352040 +0200
3ef2ca
***************
3ef2ca
*** 1078,1083 ****
3ef2ca
--- 1078,1084 ----
3ef2ca
      int		c;
3ef2ca
      int		size;
3ef2ca
      colnr_T	col2;
3ef2ca
+     colnr_T	col_adj = 0; /* col + screen size of tab */
3ef2ca
      colnr_T	colmax;
3ef2ca
      int		added;
3ef2ca
  # ifdef FEAT_MBYTE
3ef2ca
***************
3ef2ca
*** 1109,1114 ****
3ef2ca
--- 1110,1117 ----
3ef2ca
       */
3ef2ca
      size = win_chartabsize(wp, s, col);
3ef2ca
      c = *s;
3ef2ca
+     if (tab_corr)
3ef2ca
+ 	col_adj = size - 1;
3ef2ca
  
3ef2ca
      /*
3ef2ca
       * If 'linebreak' set check at a blank before a non-blank if the line
3ef2ca
***************
3ef2ca
*** 1130,1141 ****
3ef2ca
  	 */
3ef2ca
  	numberextra = win_col_off(wp);
3ef2ca
  	col2 = col;
3ef2ca
! 	colmax = (colnr_T)(W_WIDTH(wp) - numberextra);
3ef2ca
  	if (col >= colmax)
3ef2ca
  	{
3ef2ca
! 	    n = colmax + win_col_off2(wp);
3ef2ca
  	    if (n > 0)
3ef2ca
! 		colmax += (((col - colmax) / n) + 1) * n;
3ef2ca
  	}
3ef2ca
  
3ef2ca
  	for (;;)
3ef2ca
--- 1133,1145 ----
3ef2ca
  	 */
3ef2ca
  	numberextra = win_col_off(wp);
3ef2ca
  	col2 = col;
3ef2ca
! 	colmax = (colnr_T)(W_WIDTH(wp) - numberextra - col_adj);
3ef2ca
  	if (col >= colmax)
3ef2ca
  	{
3ef2ca
! 	    colmax += col_adj;
3ef2ca
! 	    n = colmax +  win_col_off2(wp);
3ef2ca
  	    if (n > 0)
3ef2ca
! 		colmax += (((col - colmax) / n) + 1) * n - col_adj;
3ef2ca
  	}
3ef2ca
  
3ef2ca
  	for (;;)
3ef2ca
***************
3ef2ca
*** 1152,1158 ****
3ef2ca
  	    col2 += win_chartabsize(wp, s, col2);
3ef2ca
  	    if (col2 >= colmax)		/* doesn't fit */
3ef2ca
  	    {
3ef2ca
! 		size = colmax - col;
3ef2ca
  		tab_corr = FALSE;
3ef2ca
  		break;
3ef2ca
  	    }
3ef2ca
--- 1156,1162 ----
3ef2ca
  	    col2 += win_chartabsize(wp, s, col2);
3ef2ca
  	    if (col2 >= colmax)		/* doesn't fit */
3ef2ca
  	    {
3ef2ca
! 		size = colmax - col + col_adj;
3ef2ca
  		tab_corr = FALSE;
3ef2ca
  		break;
3ef2ca
  	    }
3ef2ca
*** ../vim-7.4.351/src/version.c	2014-07-02 19:06:14.686326091 +0200
3ef2ca
--- src/version.c	2014-07-02 19:32:50.218350540 +0200
3ef2ca
***************
3ef2ca
*** 736,737 ****
3ef2ca
--- 736,739 ----
3ef2ca
  {   /* Add new patch number below this line */
3ef2ca
+ /**/
3ef2ca
+     352,
3ef2ca
  /**/
3ef2ca
3ef2ca
-- 
3ef2ca
The early bird gets the worm. The second mouse gets the cheese.
3ef2ca
3ef2ca
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
3ef2ca
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
3ef2ca
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
3ef2ca
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///