Karsten Hopp afc69f
To: vim-dev@vim.org
Karsten Hopp afc69f
Subject: patch 7.0.225
Karsten Hopp afc69f
Fcc: outbox
Karsten Hopp afc69f
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp afc69f
Mime-Version: 1.0
Karsten Hopp afc69f
Content-Type: text/plain; charset=ISO-8859-1
Karsten Hopp afc69f
Content-Transfer-Encoding: 8bit
Karsten Hopp afc69f
------------
Karsten Hopp afc69f
Karsten Hopp afc69f
Patch 7.0.225
Karsten Hopp afc69f
Problem:    When using setline() in an InsertEnter autocommand and doing "A"
Karsten Hopp afc69f
	    the cursor ends up on the last byte in the line. (Yukihiro
Karsten Hopp afc69f
	    Nakadaira)
Karsten Hopp afc69f
Solution:   Only adjust the column when using setline() for the cursor line.
Karsten Hopp afc69f
	    Move it back to the head byte if necessary.
Karsten Hopp afc69f
Files:	    src/eval.c, src/misc2.c
Karsten Hopp afc69f
Karsten Hopp afc69f
Karsten Hopp afc69f
*** ../vim-7.0.224/src/eval.c	Tue Mar 27 16:57:54 2007
Karsten Hopp afc69f
--- src/eval.c	Thu Apr 26 10:52:09 2007
Karsten Hopp afc69f
***************
Karsten Hopp afc69f
*** 14397,14403 ****
Karsten Hopp afc69f
  	    if (u_savesub(lnum) == OK && ml_replace(lnum, line, TRUE) == OK)
Karsten Hopp afc69f
  	    {
Karsten Hopp afc69f
  		changed_bytes(lnum, 0);
Karsten Hopp afc69f
! 		check_cursor_col();
Karsten Hopp afc69f
  		rettv->vval.v_number = 0;	/* OK */
Karsten Hopp afc69f
  	    }
Karsten Hopp afc69f
  	}
Karsten Hopp afc69f
--- 14411,14418 ----
Karsten Hopp afc69f
  	    if (u_savesub(lnum) == OK && ml_replace(lnum, line, TRUE) == OK)
Karsten Hopp afc69f
  	    {
Karsten Hopp afc69f
  		changed_bytes(lnum, 0);
Karsten Hopp afc69f
! 		if (lnum == curwin->w_cursor.lnum)
Karsten Hopp afc69f
! 		    check_cursor_col();
Karsten Hopp afc69f
  		rettv->vval.v_number = 0;	/* OK */
Karsten Hopp afc69f
  	    }
Karsten Hopp afc69f
  	}
Karsten Hopp afc69f
*** ../vim-7.0.224/src/misc2.c	Tue Feb 20 03:18:20 2007
Karsten Hopp afc69f
--- src/misc2.c	Tue Mar 27 21:59:56 2007
Karsten Hopp afc69f
***************
Karsten Hopp afc69f
*** 516,522 ****
Karsten Hopp afc69f
--- 516,529 ----
Karsten Hopp afc69f
  		|| virtual_active())
Karsten Hopp afc69f
  	    curwin->w_cursor.col = len;
Karsten Hopp afc69f
  	else
Karsten Hopp afc69f
+ 	{
Karsten Hopp afc69f
  	    curwin->w_cursor.col = len - 1;
Karsten Hopp afc69f
+ #ifdef FEAT_MBYTE
Karsten Hopp afc69f
+ 	    /* prevent cursor from moving on the trail byte */
Karsten Hopp afc69f
+ 	    if (has_mbyte)
Karsten Hopp afc69f
+ 		mb_adjust_cursor();
Karsten Hopp afc69f
+ #endif
Karsten Hopp afc69f
+ 	}
Karsten Hopp afc69f
      }
Karsten Hopp afc69f
  
Karsten Hopp afc69f
  #ifdef FEAT_VIRTUALEDIT
Karsten Hopp afc69f
*** ../vim-7.0.224/src/version.c	Tue Mar 27 16:57:54 2007
Karsten Hopp afc69f
--- src/version.c	Thu Apr 26 10:53:33 2007
Karsten Hopp afc69f
***************
Karsten Hopp afc69f
*** 668,669 ****
Karsten Hopp afc69f
--- 668,671 ----
Karsten Hopp afc69f
  {   /* Add new patch number below this line */
Karsten Hopp afc69f
+ /**/
Karsten Hopp afc69f
+     225,
Karsten Hopp afc69f
  /**/
Karsten Hopp afc69f
Karsten Hopp afc69f
-- 
Karsten Hopp afc69f
hundred-and-one symptoms of being an internet addict:
Karsten Hopp afc69f
14. You start introducing yourself as "Jim at I-I-Net dot net dot au"
Karsten Hopp afc69f
Karsten Hopp afc69f
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp afc69f
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp afc69f
\\\        download, build and distribute -- http://www.A-A-P.org        ///
Karsten Hopp afc69f
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///