]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
updated for version 7.4.675 v7.4.675
authorBram Moolenaar <Bram@vim.org>
Tue, 24 Mar 2015 10:46:30 +0000 (11:46 +0100)
committerBram Moolenaar <Bram@vim.org>
Tue, 24 Mar 2015 10:46:30 +0000 (11:46 +0100)
Problem:    When a FileReadPost autocommand moves the cursor inside a line it
            gets moved back.
Solution:   When checking whether an autocommand moved the cursor store the
            column as well. (Christian Brabandt)

src/ex_cmds.c
src/version.c

index 314a466993ffdce480452605692f7bd2265aef29..ef0ec1ffeac3c59b5fb93b102d7fd48c761b189f 100644 (file)
@@ -3185,7 +3185,7 @@ do_ecmd(fnum, ffname, sfname, eap, newlnum, flags, oldwin)
 #endif
     int                retval = FAIL;
     long       n;
-    linenr_T   lnum;
+    pos_T      orig_pos;
     linenr_T   topline = 0;
     int                newcol = -1;
     int                solcol = -1;
@@ -3678,7 +3678,7 @@ do_ecmd(fnum, ffname, sfname, eap, newlnum, flags, oldwin)
         * Careful: open_buffer() and apply_autocmds() may change the current
         * buffer and window.
         */
-       lnum = curwin->w_cursor.lnum;
+       orig_pos = curwin->w_cursor;
        topline = curwin->w_topline;
        if (!oldbuf)                        /* need to read the file */
        {
@@ -3719,11 +3719,9 @@ do_ecmd(fnum, ffname, sfname, eap, newlnum, flags, oldwin)
        check_arg_idx(curwin);
 #endif
 
-       /*
-        * If autocommands change the cursor position or topline, we should
-        * keep it.
-        */
-       if (curwin->w_cursor.lnum != lnum)
+       /* If autocommands change the cursor position or topline, we should
+        * keep it.  Also when it moves within a line. */
+       if (!equalpos(curwin->w_cursor, orig_pos))
        {
            newlnum = curwin->w_cursor.lnum;
            newcol = curwin->w_cursor.col;
index f86a9552f5711f27cccb97210bf60d44ce674364..bb19cb75e97aa4e6612afea3a1564a7be158af7b 100644 (file)
@@ -741,6 +741,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    675,
 /**/
     674,
 /**/