updated for version 7.3.812 v7.3.812
authorBram Moolenaar <Bram@vim.org>
Wed, 13 Feb 2013 15:10:17 +0000 (16:10 +0100)
committerBram Moolenaar <Bram@vim.org>
Wed, 13 Feb 2013 15:10:17 +0000 (16:10 +0100)
Problem:    When 'indentexpr' moves the cursor "curswant" not restored.
Solution:   Restore "curswant". (Sung Pae)

src/misc1.c
src/version.c

index ab42f04db1fc60d0da038ea91fbbce2581527a16..e2c92090b31d17c73581ddb18fef4f1448ac8343 100644 (file)
@@ -8809,12 +8809,18 @@ find_match(lookfor, ourscope, ind_maxparen, ind_maxcomment)
 get_expr_indent()
 {
     int                indent;
-    pos_T      pos;
+    pos_T      save_pos;
+    colnr_T    save_curswant;
+    int                save_set_curswant;
     int                save_State;
     int                use_sandbox = was_set_insecurely((char_u *)"indentexpr",
                                                                   OPT_LOCAL);
 
-    pos = curwin->w_cursor;
+    /* Save and restore cursor position and curswant, in case it was changed
+     * via :normal commands */
+    save_pos = curwin->w_cursor;
+    save_curswant = curwin->w_curswant;
+    save_set_curswant = curwin->w_set_curswant;
     set_vim_var_nr(VV_LNUM, curwin->w_cursor.lnum);
     if (use_sandbox)
        ++sandbox;
@@ -8829,7 +8835,9 @@ get_expr_indent()
      * command. */
     save_State = State;
     State = INSERT;
-    curwin->w_cursor = pos;
+    curwin->w_cursor = save_pos;
+    curwin->w_curswant = save_curswant;
+    curwin->w_set_curswant = save_set_curswant;
     check_cursor();
     State = save_State;
 
index 1ce53266ba8d386f7428995b34602dd1464bd8be..4429b0f0f262a98159d20022964cc6b02430e7c4 100644 (file)
@@ -725,6 +725,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    812,
 /**/
     811,
 /**/