4 From: Bram Moolenaar <Bram@moolenaar.net>
6 Content-Type: text/plain; charset=ISO-8859-1
7 Content-Transfer-Encoding: 8bit
11 Problem: v:prevcount is changed too often. Counts are not multiplied when
13 Solution: Set v:prevcount properly. Multiply counts. (idea by Ben Schmidt)
14 Files: src/eval.c, src/normal.c, src/proto/eval.pro
17 *** ../vim-7.2.047/src/eval.c Thu Nov 20 10:36:04 2008
18 --- src/eval.c Thu Nov 20 15:53:47 2008
24 ! * Set v:count, v:count1 and v:prevcount.
27 ! set_vcount(count, count1)
31 ! vimvars[VV_PREVCOUNT].vv_nr = vimvars[VV_COUNT].vv_nr;
32 vimvars[VV_COUNT].vv_nr = count;
33 vimvars[VV_COUNT1].vv_nr = count1;
39 ! * Set v:count to "count" and v:count1 to "count1".
40 ! * When "set_prevcount" is TRUE first set v:prevcount from v:count.
43 ! set_vcount(count, count1, set_prevcount)
49 ! vimvars[VV_PREVCOUNT].vv_nr = vimvars[VV_COUNT].vv_nr;
50 vimvars[VV_COUNT].vv_nr = count;
51 vimvars[VV_COUNT1].vv_nr = count1;
53 *** ../vim-7.2.047/src/normal.c Sat Nov 15 14:10:23 2008
54 --- src/normal.c Thu Nov 20 16:04:44 2008
58 static int old_mapped_len = 0;
62 + int set_prevcount = FALSE;
65 vim_memset(&ca, 0, sizeof(ca)); /* also resets ca.retval */
70 /* When not finishing an operator and no register name typed, reset the
72 if (!finish_op && !oap->regname)
76 + set_prevcount = TRUE;
81 /* Restore counts from before receiving K_CURSORHOLD. This means after
84 * command, so that v:count can be used in an expression mapping
85 * right after the count. */
86 if (toplevel && stuff_empty())
87 ! set_vcount(ca.count0, ca.count0 == 0 ? 1 : ca.count0);
92 * command, so that v:count can be used in an expression mapping
93 * right after the count. */
94 if (toplevel && stuff_empty())
96 ! long count = ca.count0;
98 ! /* multiply with ca.opcount the same way as below */
99 ! if (ca.opcount != 0)
100 ! count = ca.opcount * (count == 0 ? 1 : count);
101 ! set_vcount(count, count == 0 ? 1 : count, set_prevcount);
102 ! set_prevcount = FALSE; /* only set v:prevcount once */
109 * Only set v:count when called from main() and not a stuffed command.
111 if (toplevel && stuff_empty())
112 ! set_vcount(ca.count0, ca.count1);
117 * Only set v:count when called from main() and not a stuffed command.
119 if (toplevel && stuff_empty())
120 ! set_vcount(ca.count0, ca.count1, set_prevcount);
124 *** ../vim-7.2.047/src/proto/eval.pro Sun Nov 9 13:43:25 2008
125 --- src/proto/eval.pro Thu Nov 20 15:53:54 2008
128 long get_vim_var_nr __ARGS((int idx));
129 char_u *get_vim_var_str __ARGS((int idx));
130 list_T *get_vim_var_list __ARGS((int idx));
131 ! void set_vcount __ARGS((long count, long count1));
132 void set_vim_var_string __ARGS((int idx, char_u *val, int len));
133 void set_vim_var_list __ARGS((int idx, list_T *val));
134 void set_reg_var __ARGS((int c));
136 long get_vim_var_nr __ARGS((int idx));
137 char_u *get_vim_var_str __ARGS((int idx));
138 list_T *get_vim_var_list __ARGS((int idx));
139 ! void set_vcount __ARGS((long count, long count1, int set_prevcount));
140 void set_vim_var_string __ARGS((int idx, char_u *val, int len));
141 void set_vim_var_list __ARGS((int idx, list_T *val));
142 void set_reg_var __ARGS((int c));
143 *** ../vim-7.2.047/src/version.c Thu Nov 20 14:11:47 2008
144 --- src/version.c Thu Nov 20 16:08:19 2008
148 { /* Add new patch number below this line */
154 Microsoft's definition of a boolean: TRUE, FALSE, MAYBE
155 "Embrace and extend"...?
157 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
158 /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
159 \\\ download, build and distribute -- http://www.A-A-P.org ///
160 \\\ help me help AIDS victims -- http://ICCF-Holland.org ///