astepano / rpms / vim

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