Karsten Hopp a1e4e1
To: vim-dev@vim.org
Karsten Hopp a1e4e1
Subject: Patch 7.3.020
Karsten Hopp a1e4e1
Fcc: outbox
Karsten Hopp a1e4e1
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp a1e4e1
Mime-Version: 1.0
Karsten Hopp a1e4e1
Content-Type: text/plain; charset=UTF-8
Karsten Hopp a1e4e1
Content-Transfer-Encoding: 8bit
Karsten Hopp a1e4e1
------------
Karsten Hopp a1e4e1
Karsten Hopp a1e4e1
Patch 7.3.020
Karsten Hopp a1e4e1
Problem:    Cursor position wrong when joining multiple lines and
Karsten Hopp a1e4e1
	    'formatoptions' contains "a". (Moshe Kamensky)
Karsten Hopp a1e4e1
Solution:   Adjust cursor position for skipped indent. (Carlo Teubner)
Karsten Hopp a1e4e1
Files:	    src/ops.c, src/testdir/test68.in, src/testdir/test68.ok
Karsten Hopp a1e4e1
Karsten Hopp a1e4e1
Karsten Hopp a1e4e1
*** ../vim-7.3.019/src/ops.c	2010-08-15 21:57:28.000000000 +0200
Karsten Hopp a1e4e1
--- src/ops.c	2010-10-09 17:00:35.000000000 +0200
Karsten Hopp a1e4e1
***************
Karsten Hopp a1e4e1
*** 4153,4161 ****
Karsten Hopp a1e4e1
      int	    save_undo;
Karsten Hopp a1e4e1
  {
Karsten Hopp a1e4e1
      char_u	*curr = NULL;
Karsten Hopp a1e4e1
      char_u	*cend;
Karsten Hopp a1e4e1
      char_u	*newp;
Karsten Hopp a1e4e1
!     char_u	*spaces;	/* number of spaces inserte before a line */
Karsten Hopp a1e4e1
      int		endcurr1 = NUL;
Karsten Hopp a1e4e1
      int		endcurr2 = NUL;
Karsten Hopp a1e4e1
      int		currsize = 0;	/* size of the current line */
Karsten Hopp a1e4e1
--- 4153,4162 ----
Karsten Hopp a1e4e1
      int	    save_undo;
Karsten Hopp a1e4e1
  {
Karsten Hopp a1e4e1
      char_u	*curr = NULL;
Karsten Hopp a1e4e1
+     char_u      *curr_start = NULL;
Karsten Hopp a1e4e1
      char_u	*cend;
Karsten Hopp a1e4e1
      char_u	*newp;
Karsten Hopp a1e4e1
!     char_u	*spaces;	/* number of spaces inserted before a line */
Karsten Hopp a1e4e1
      int		endcurr1 = NUL;
Karsten Hopp a1e4e1
      int		endcurr2 = NUL;
Karsten Hopp a1e4e1
      int		currsize = 0;	/* size of the current line */
Karsten Hopp a1e4e1
***************
Karsten Hopp a1e4e1
*** 4181,4187 ****
Karsten Hopp a1e4e1
       */
Karsten Hopp a1e4e1
      for (t = 0; t < count; ++t)
Karsten Hopp a1e4e1
      {
Karsten Hopp a1e4e1
! 	curr = ml_get((linenr_T)(curwin->w_cursor.lnum + t));
Karsten Hopp a1e4e1
  	if (insert_space && t > 0)
Karsten Hopp a1e4e1
  	{
Karsten Hopp a1e4e1
  	    curr = skipwhite(curr);
Karsten Hopp a1e4e1
--- 4182,4188 ----
Karsten Hopp a1e4e1
       */
Karsten Hopp a1e4e1
      for (t = 0; t < count; ++t)
Karsten Hopp a1e4e1
      {
Karsten Hopp a1e4e1
! 	curr = curr_start = ml_get((linenr_T)(curwin->w_cursor.lnum + t));
Karsten Hopp a1e4e1
  	if (insert_space && t > 0)
Karsten Hopp a1e4e1
  	{
Karsten Hopp a1e4e1
  	    curr = skipwhite(curr);
Karsten Hopp a1e4e1
***************
Karsten Hopp a1e4e1
*** 4265,4274 ****
Karsten Hopp a1e4e1
  	    copy_spaces(cend, (size_t)(spaces[t]));
Karsten Hopp a1e4e1
  	}
Karsten Hopp a1e4e1
  	mark_col_adjust(curwin->w_cursor.lnum + t, (colnr_T)0, (linenr_T)-t,
Karsten Hopp a1e4e1
! 				 (long)(cend - newp + spaces[t]));
Karsten Hopp a1e4e1
  	if (t == 0)
Karsten Hopp a1e4e1
  	    break;
Karsten Hopp a1e4e1
! 	curr = ml_get((linenr_T)(curwin->w_cursor.lnum + t - 1));
Karsten Hopp a1e4e1
  	if (insert_space && t > 1)
Karsten Hopp a1e4e1
  	    curr = skipwhite(curr);
Karsten Hopp a1e4e1
  	currsize = (int)STRLEN(curr);
Karsten Hopp a1e4e1
--- 4266,4275 ----
Karsten Hopp a1e4e1
  	    copy_spaces(cend, (size_t)(spaces[t]));
Karsten Hopp a1e4e1
  	}
Karsten Hopp a1e4e1
  	mark_col_adjust(curwin->w_cursor.lnum + t, (colnr_T)0, (linenr_T)-t,
Karsten Hopp a1e4e1
! 			 (long)(cend - newp + spaces[t] - (curr - curr_start)));
Karsten Hopp a1e4e1
  	if (t == 0)
Karsten Hopp a1e4e1
  	    break;
Karsten Hopp a1e4e1
! 	curr = curr_start = ml_get((linenr_T)(curwin->w_cursor.lnum + t - 1));
Karsten Hopp a1e4e1
  	if (insert_space && t > 1)
Karsten Hopp a1e4e1
  	    curr = skipwhite(curr);
Karsten Hopp a1e4e1
  	currsize = (int)STRLEN(curr);
Karsten Hopp a1e4e1
*** ../vim-7.3.019/src/testdir/test68.in	2010-08-15 21:57:29.000000000 +0200
Karsten Hopp a1e4e1
--- src/testdir/test68.in	2010-10-09 16:53:02.000000000 +0200
Karsten Hopp a1e4e1
***************
Karsten Hopp a1e4e1
*** 51,56 ****
Karsten Hopp a1e4e1
--- 51,67 ----
Karsten Hopp a1e4e1
  }
Karsten Hopp a1e4e1
  
Karsten Hopp a1e4e1
  STARTTEST
Karsten Hopp a1e4e1
+ /^{/+2
Karsten Hopp a1e4e1
+ :set tw& fo=a
Karsten Hopp a1e4e1
+ I^^?
Karsten Hopp a1e4e1
+ ENDTEST
Karsten Hopp a1e4e1
+ 
Karsten Hopp a1e4e1
+ {
Karsten Hopp a1e4e1
+    1aa
Karsten Hopp a1e4e1
+    2bb
Karsten Hopp a1e4e1
+ }
Karsten Hopp a1e4e1
+ 
Karsten Hopp a1e4e1
+ STARTTEST
Karsten Hopp a1e4e1
  :g/^STARTTEST/.,/^ENDTEST/d
Karsten Hopp a1e4e1
  :1;/^Results/,$wq! test.out
Karsten Hopp a1e4e1
  ENDTEST
Karsten Hopp a1e4e1
*** ../vim-7.3.019/src/testdir/test68.ok	2010-08-15 21:57:29.000000000 +0200
Karsten Hopp a1e4e1
--- src/testdir/test68.ok	2010-10-09 16:53:02.000000000 +0200
Karsten Hopp a1e4e1
***************
Karsten Hopp a1e4e1
*** 33,35 ****
Karsten Hopp a1e4e1
--- 33,38 ----
Karsten Hopp a1e4e1
  #a b
Karsten Hopp a1e4e1
  }
Karsten Hopp a1e4e1
  
Karsten Hopp a1e4e1
+ 
Karsten Hopp a1e4e1
+ { 1aa ^^2bb }
Karsten Hopp a1e4e1
+ 
Karsten Hopp a1e4e1
*** ../vim-7.3.019/src/version.c	2010-09-30 21:03:13.000000000 +0200
Karsten Hopp a1e4e1
--- src/version.c	2010-10-09 17:05:31.000000000 +0200
Karsten Hopp a1e4e1
***************
Karsten Hopp a1e4e1
*** 716,717 ****
Karsten Hopp a1e4e1
--- 716,719 ----
Karsten Hopp a1e4e1
  {   /* Add new patch number below this line */
Karsten Hopp a1e4e1
+ /**/
Karsten Hopp a1e4e1
+     20,
Karsten Hopp a1e4e1
  /**/
Karsten Hopp a1e4e1
Karsten Hopp a1e4e1
-- 
Karsten Hopp a1e4e1
Did you hear about the new 3 million dollar West Virginia State Lottery?
Karsten Hopp a1e4e1
The winner gets 3 dollars a year for a million years.
Karsten Hopp a1e4e1
Karsten Hopp a1e4e1
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp a1e4e1
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp a1e4e1
\\\        download, build and distribute -- http://www.A-A-P.org        ///
Karsten Hopp a1e4e1
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///