]> granicus.if.org Git - vim/commitdiff
updated for version 7.3.086 v7.3.086
authorBram Moolenaar <Bram@vim.org>
Fri, 17 Dec 2010 17:53:01 +0000 (18:53 +0100)
committerBram Moolenaar <Bram@vim.org>
Fri, 17 Dec 2010 17:53:01 +0000 (18:53 +0100)
Problem:    When using a mapping with an expression and there was no count,
            v:count has the value of the previous command. (ZyX)
Solution:   Also set v:count and v:count1 before getting the character that
            could be a command or a count.

src/normal.c
src/version.c

index 1754e8aa0803fc920f11dfcba01a3a1de12957a7..fe306675b0a3e95d718c0c76b6d2c56666740fb5 100644 (file)
@@ -25,6 +25,9 @@ static colnr_T        resel_VIsual_col;               /* nr of cols or end col */
 static int     restart_VIsual_select = 0;
 #endif
 
+#ifdef FEAT_EVAL
+static void    set_vcount_ca __ARGS((cmdarg_T *cap, int *set_prevcount));
+#endif
 static int
 # ifdef __BORLANDC__
 _RTLENTRYF
@@ -648,6 +651,14 @@ normal_cmd(oap, toplevel)
     dont_scroll = FALSE;       /* allow scrolling here */
 #endif
 
+#ifdef FEAT_EVAL
+    /* Set v:count here, when called from main() and not a stuffed
+     * command, so that v:count can be used in an expression mapping
+     * when there is no count. */
+    if (toplevel && stuff_empty())
+       set_vcount_ca(&ca, &set_prevcount);
+#endif
+
     /*
      * Get the command character from the user.
      */
@@ -725,15 +736,7 @@ getcount:
             * command, so that v:count can be used in an expression mapping
             * right after the count. */
            if (toplevel && stuff_empty())
-           {
-               long count = ca.count0;
-
-               /* multiply with ca.opcount the same way as below */
-               if (ca.opcount != 0)
-                   count = ca.opcount * (count == 0 ? 1 : count);
-               set_vcount(count, count == 0 ? 1 : count, set_prevcount);
-               set_prevcount = FALSE;  /* only set v:prevcount once */
-           }
+               set_vcount_ca(&ca, &set_prevcount);
 #endif
            if (ctrl_w)
            {
@@ -1386,6 +1389,26 @@ normal_end:
     opcount = ca.opcount;
 }
 
+#ifdef FEAT_EVAL
+/*
+ * Set v:count and v:count1 according to "cap".
+ * Set v:prevcount only when "set_prevcount" is TRUE.
+ */
+    static void
+set_vcount_ca(cap, set_prevcount)
+    cmdarg_T   *cap;
+    int                *set_prevcount;
+{
+    long count = cap->count0;
+
+    /* multiply with cap->opcount the same way as above */
+    if (cap->opcount != 0)
+       count = cap->opcount * (count == 0 ? 1 : count);
+    set_vcount(count, count == 0 ? 1 : count, *set_prevcount);
+    *set_prevcount = FALSE;  /* only set v:prevcount once */
+}
+#endif
+
 /*
  * Handle an operator after visual mode or when the movement is finished
  */
@@ -8529,7 +8552,7 @@ nv_pipe(cap)
     else
        curwin->w_curswant = 0;
     /* keep curswant at the column where we wanted to go, not where
-       we ended; differs if line is too short */
+     * we ended; differs if line is too short */
     curwin->w_set_curswant = FALSE;
 }
 
index 7372e9a1c3bfa1c2eab4bc81905284063eb35e15..d3ad470920392b42e9b159971ac4115b3976a5e4 100644 (file)
@@ -714,6 +714,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    86,
 /**/
     85,
 /**/