]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
updated for version 7.3.768 v7.3.768
authorBram Moolenaar <Bram@vim.org>
Thu, 17 Jan 2013 14:37:01 +0000 (15:37 +0100)
committerBram Moolenaar <Bram@vim.org>
Thu, 17 Jan 2013 14:37:01 +0000 (15:37 +0100)
Problem:    settabvar() and setwinvar() may move the cursor.
Solution:   Save and restore the cursor position when appropriate. (idea by
            Yasuhiro Matsumoto)

src/edit.c
src/version.c

index 0d940954668b97cf652c02355c53fb9fbb0f76b5..50c1fca6bdef6afd5d0d55207c5506c8c3c040e7 100644 (file)
@@ -372,6 +372,8 @@ edit(cmdchar, startln, count)
      */
     if (cmdchar != 'r' && cmdchar != 'v')
     {
+       pos_T   save_cursor = curwin->w_cursor;
+
 # ifdef FEAT_EVAL
        if (cmdchar == 'R')
            ptr = (char_u *)"r";
@@ -382,6 +384,19 @@ edit(cmdchar, startln, count)
        set_vim_var_string(VV_INSERTMODE, ptr, 1);
 # endif
        apply_autocmds(EVENT_INSERTENTER, NULL, NULL, FALSE, curbuf);
+
+       /* Since Insert mode was not started yet a call to check_cursor_col()
+        * may have moved the cursor, especially with the "A" command. */
+       if (curwin->w_cursor.col != save_cursor.col
+               && curwin->w_cursor.lnum == save_cursor.lnum)
+       {
+           int save_state = State;
+
+           curwin->w_cursor = save_cursor;
+           State = INSERT;
+           check_cursor_col();
+           State = save_state;
+       }
     }
 #endif
 
index 321740010998f6801ac25c745a302a6c5af7e808..251cec8133cbf79c896057b2ab77acf705a2a441 100644 (file)
@@ -725,6 +725,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    768,
 /**/
     767,
 /**/