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