]>
Commit | Line | Data |
---|---|---|
a6d1e5bc ER |
1 | To: vim_dev@googlegroups.com |
2 | Subject: Patch 7.3.086 | |
3 | Fcc: outbox | |
4 | From: Bram Moolenaar <Bram@moolenaar.net> | |
5 | Mime-Version: 1.0 | |
6 | Content-Type: text/plain; charset=UTF-8 | |
7 | Content-Transfer-Encoding: 8bit | |
8 | ------------ | |
9 | ||
10 | Patch 7.3.086 | |
11 | Problem: When using a mapping with an expression and there was no count, | |
12 | v:count has the value of the previous command. (ZyX) | |
13 | Solution: Also set v:count and v:count1 before getting the character that | |
14 | could be a command or a count. | |
15 | Files: src/normal.c | |
16 | ||
17 | ||
18 | *** ../vim-7.3.085/src/normal.c 2010-10-13 18:06:42.000000000 +0200 | |
19 | --- src/normal.c 2010-12-17 18:46:56.000000000 +0100 | |
20 | *************** | |
21 | *** 25,30 **** | |
22 | --- 25,33 ---- | |
23 | static int restart_VIsual_select = 0; | |
24 | #endif | |
25 | ||
26 | + #ifdef FEAT_EVAL | |
27 | + static void set_vcount_ca __ARGS((cmdarg_T *cap, int *set_prevcount)); | |
28 | + #endif | |
29 | static int | |
30 | # ifdef __BORLANDC__ | |
31 | _RTLENTRYF | |
32 | *************** | |
33 | *** 648,653 **** | |
34 | --- 651,664 ---- | |
35 | dont_scroll = FALSE; /* allow scrolling here */ | |
36 | #endif | |
37 | ||
38 | + #ifdef FEAT_EVAL | |
39 | + /* Set v:count here, when called from main() and not a stuffed | |
40 | + * command, so that v:count can be used in an expression mapping | |
41 | + * when there is no count. */ | |
42 | + if (toplevel && stuff_empty()) | |
43 | + set_vcount_ca(&ca, &set_prevcount); | |
44 | + #endif | |
45 | + | |
46 | /* | |
47 | * Get the command character from the user. | |
48 | */ | |
49 | *************** | |
50 | *** 725,739 **** | |
51 | * command, so that v:count can be used in an expression mapping | |
52 | * right after the count. */ | |
53 | if (toplevel && stuff_empty()) | |
54 | ! { | |
55 | ! long count = ca.count0; | |
56 | ! | |
57 | ! /* multiply with ca.opcount the same way as below */ | |
58 | ! if (ca.opcount != 0) | |
59 | ! count = ca.opcount * (count == 0 ? 1 : count); | |
60 | ! set_vcount(count, count == 0 ? 1 : count, set_prevcount); | |
61 | ! set_prevcount = FALSE; /* only set v:prevcount once */ | |
62 | ! } | |
63 | #endif | |
64 | if (ctrl_w) | |
65 | { | |
66 | --- 736,742 ---- | |
67 | * command, so that v:count can be used in an expression mapping | |
68 | * right after the count. */ | |
69 | if (toplevel && stuff_empty()) | |
70 | ! set_vcount_ca(&ca, &set_prevcount); | |
71 | #endif | |
72 | if (ctrl_w) | |
73 | { | |
74 | *************** | |
75 | *** 1386,1391 **** | |
76 | --- 1389,1414 ---- | |
77 | opcount = ca.opcount; | |
78 | } | |
79 | ||
80 | + #ifdef FEAT_EVAL | |
81 | + /* | |
82 | + * Set v:count and v:count1 according to "cap". | |
83 | + * Set v:prevcount only when "set_prevcount" is TRUE. | |
84 | + */ | |
85 | + static void | |
86 | + set_vcount_ca(cap, set_prevcount) | |
87 | + cmdarg_T *cap; | |
88 | + int *set_prevcount; | |
89 | + { | |
90 | + long count = cap->count0; | |
91 | + | |
92 | + /* multiply with cap->opcount the same way as above */ | |
93 | + if (cap->opcount != 0) | |
94 | + count = cap->opcount * (count == 0 ? 1 : count); | |
95 | + set_vcount(count, count == 0 ? 1 : count, *set_prevcount); | |
96 | + *set_prevcount = FALSE; /* only set v:prevcount once */ | |
97 | + } | |
98 | + #endif | |
99 | + | |
100 | /* | |
101 | * Handle an operator after visual mode or when the movement is finished | |
102 | */ | |
103 | *************** | |
104 | *** 8529,8535 **** | |
105 | else | |
106 | curwin->w_curswant = 0; | |
107 | /* keep curswant at the column where we wanted to go, not where | |
108 | ! we ended; differs if line is too short */ | |
109 | curwin->w_set_curswant = FALSE; | |
110 | } | |
111 | ||
112 | --- 8552,8558 ---- | |
113 | else | |
114 | curwin->w_curswant = 0; | |
115 | /* keep curswant at the column where we wanted to go, not where | |
116 | ! * we ended; differs if line is too short */ | |
117 | curwin->w_set_curswant = FALSE; | |
118 | } | |
119 | ||
120 | *** ../vim-7.3.085/src/version.c 2010-12-17 18:06:00.000000000 +0100 | |
121 | --- src/version.c 2010-12-17 18:51:20.000000000 +0100 | |
122 | *************** | |
123 | *** 716,717 **** | |
124 | --- 716,719 ---- | |
125 | { /* Add new patch number below this line */ | |
126 | + /**/ | |
127 | + 86, | |
128 | /**/ | |
129 | ||
130 | -- | |
131 | How To Keep A Healthy Level Of Insanity: | |
132 | 15. Five days in advance, tell your friends you can't attend their | |
133 | party because you're not in the mood. | |
134 | ||
135 | /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ | |
136 | /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ | |
137 | \\\ an exciting new programming language -- http://www.Zimbu.org /// | |
138 | \\\ help me help AIDS victims -- http://ICCF-Holland.org /// |