Karsten Hopp a84c03
To: vim_dev@googlegroups.com
Karsten Hopp a84c03
Subject: Patch 7.4.675
Karsten Hopp a84c03
Fcc: outbox
Karsten Hopp a84c03
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp a84c03
Mime-Version: 1.0
Karsten Hopp a84c03
Content-Type: text/plain; charset=UTF-8
Karsten Hopp a84c03
Content-Transfer-Encoding: 8bit
Karsten Hopp a84c03
------------
Karsten Hopp a84c03
Karsten Hopp a84c03
Patch 7.4.675
Karsten Hopp a84c03
Problem:    When a FileReadPost autocommand moves the cursor inside a line it
Karsten Hopp a84c03
	    gets moved back.
Karsten Hopp a84c03
Solution:   When checking whether an autocommand moved the cursor store the
Karsten Hopp a84c03
	    column as well. (Christian Brabandt)
Karsten Hopp a84c03
Files:	    src/ex_cmds.c
Karsten Hopp a84c03
Karsten Hopp a84c03
Karsten Hopp a84c03
*** ../vim-7.4.674/src/ex_cmds.c	2015-02-27 19:34:51.464777369 +0100
Karsten Hopp a84c03
--- src/ex_cmds.c	2015-03-24 11:42:38.796239766 +0100
Karsten Hopp a84c03
***************
Karsten Hopp a84c03
*** 3185,3191 ****
Karsten Hopp a84c03
  #endif
Karsten Hopp a84c03
      int		retval = FAIL;
Karsten Hopp a84c03
      long	n;
Karsten Hopp a84c03
!     linenr_T	lnum;
Karsten Hopp a84c03
      linenr_T	topline = 0;
Karsten Hopp a84c03
      int		newcol = -1;
Karsten Hopp a84c03
      int		solcol = -1;
Karsten Hopp a84c03
--- 3185,3191 ----
Karsten Hopp a84c03
  #endif
Karsten Hopp a84c03
      int		retval = FAIL;
Karsten Hopp a84c03
      long	n;
Karsten Hopp a84c03
!     pos_T	orig_pos;
Karsten Hopp a84c03
      linenr_T	topline = 0;
Karsten Hopp a84c03
      int		newcol = -1;
Karsten Hopp a84c03
      int		solcol = -1;
Karsten Hopp a84c03
***************
Karsten Hopp a84c03
*** 3678,3684 ****
Karsten Hopp a84c03
  	 * Careful: open_buffer() and apply_autocmds() may change the current
Karsten Hopp a84c03
  	 * buffer and window.
Karsten Hopp a84c03
  	 */
Karsten Hopp a84c03
! 	lnum = curwin->w_cursor.lnum;
Karsten Hopp a84c03
  	topline = curwin->w_topline;
Karsten Hopp a84c03
  	if (!oldbuf)			    /* need to read the file */
Karsten Hopp a84c03
  	{
Karsten Hopp a84c03
--- 3678,3684 ----
Karsten Hopp a84c03
  	 * Careful: open_buffer() and apply_autocmds() may change the current
Karsten Hopp a84c03
  	 * buffer and window.
Karsten Hopp a84c03
  	 */
Karsten Hopp a84c03
! 	orig_pos = curwin->w_cursor;
Karsten Hopp a84c03
  	topline = curwin->w_topline;
Karsten Hopp a84c03
  	if (!oldbuf)			    /* need to read the file */
Karsten Hopp a84c03
  	{
Karsten Hopp a84c03
***************
Karsten Hopp a84c03
*** 3719,3729 ****
Karsten Hopp a84c03
  	check_arg_idx(curwin);
Karsten Hopp a84c03
  #endif
Karsten Hopp a84c03
  
Karsten Hopp a84c03
! 	/*
Karsten Hopp a84c03
! 	 * If autocommands change the cursor position or topline, we should
Karsten Hopp a84c03
! 	 * keep it.
Karsten Hopp a84c03
! 	 */
Karsten Hopp a84c03
! 	if (curwin->w_cursor.lnum != lnum)
Karsten Hopp a84c03
  	{
Karsten Hopp a84c03
  	    newlnum = curwin->w_cursor.lnum;
Karsten Hopp a84c03
  	    newcol = curwin->w_cursor.col;
Karsten Hopp a84c03
--- 3719,3727 ----
Karsten Hopp a84c03
  	check_arg_idx(curwin);
Karsten Hopp a84c03
  #endif
Karsten Hopp a84c03
  
Karsten Hopp a84c03
! 	/* If autocommands change the cursor position or topline, we should
Karsten Hopp a84c03
! 	 * keep it.  Also when it moves within a line. */
Karsten Hopp a84c03
! 	if (!equalpos(curwin->w_cursor, orig_pos))
Karsten Hopp a84c03
  	{
Karsten Hopp a84c03
  	    newlnum = curwin->w_cursor.lnum;
Karsten Hopp a84c03
  	    newcol = curwin->w_cursor.col;
Karsten Hopp a84c03
*** ../vim-7.4.674/src/version.c	2015-03-21 22:18:37.808371766 +0100
Karsten Hopp a84c03
--- src/version.c	2015-03-24 11:44:14.240327255 +0100
Karsten Hopp a84c03
***************
Karsten Hopp a84c03
*** 743,744 ****
Karsten Hopp a84c03
--- 743,746 ----
Karsten Hopp a84c03
  {   /* Add new patch number below this line */
Karsten Hopp a84c03
+ /**/
Karsten Hopp a84c03
+     675,
Karsten Hopp a84c03
  /**/
Karsten Hopp a84c03
Karsten Hopp a84c03
-- 
Karsten Hopp a84c03
There are three kinds of people: Those who can count & those who can't.
Karsten Hopp a84c03
Karsten Hopp a84c03
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp a84c03
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp a84c03
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp a84c03
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///