]> git.pld-linux.org Git - packages/vim.git/blame - 7.1.162
- updated to 0.7.5
[packages/vim.git] / 7.1.162
CommitLineData
e98ed9b1
ER
1To: vim-dev@vim.org
2Subject: Patch 7.1.162
3Fcc: outbox
4From: Bram Moolenaar <Bram@moolenaar.net>
5Mime-Version: 1.0
6Content-Type: text/plain; charset=ISO-8859-1
7Content-Transfer-Encoding: 8bit
8------------
9
10Patch 7.1.162
11Problem: Crash when using a modifier before "while" or "for". (A.Politz)
12Solution: Skip modifiers when checking for a loop command.
13Files: src/proto/ex_docmd.pro, src/ex_docmd.c, src/ex_eval.c
14
15
16*** ../vim-7.1.161/src/proto/ex_docmd.pro Sun Sep 30 14:00:41 2007
17--- src/proto/ex_docmd.pro Sat Nov 24 16:34:06 2007
18***************
19*** 5,10 ****
20--- 5,11 ----
21 int getline_equal __ARGS((char_u *(*fgetline)(int, void *, int), void *cookie, char_u *(*func)(int, void *, int)));
22 void *getline_cookie __ARGS((char_u *(*fgetline)(int, void *, int), void *cookie));
23 int checkforcmd __ARGS((char_u **pp, char *cmd, int len));
24+ int modifier_len __ARGS((char_u *cmd));
25 int cmd_exists __ARGS((char_u *name));
26 char_u *set_one_cmd_context __ARGS((expand_T *xp, char_u *buff));
27 char_u *skip_range __ARGS((char_u *cmd, int *ctx));
28*** ../vim-7.1.161/src/ex_docmd.c Tue Nov 20 12:30:31 2007
29--- src/ex_docmd.c Sat Nov 24 16:41:20 2007
30***************
31*** 2963,2968 ****
32--- 2963,3019 ----
33 #endif
34
35 #if defined(FEAT_EVAL) || defined(PROTO)
36+ static struct cmdmod
37+ {
38+ char *name;
39+ int minlen;
40+ int has_count; /* :123verbose :3tab */
41+ } cmdmods[] = {
42+ {"aboveleft", 3, FALSE},
43+ {"belowright", 3, FALSE},
44+ {"botright", 2, FALSE},
45+ {"browse", 3, FALSE},
46+ {"confirm", 4, FALSE},
47+ {"hide", 3, FALSE},
48+ {"keepalt", 5, FALSE},
49+ {"keepjumps", 5, FALSE},
50+ {"keepmarks", 3, FALSE},
51+ {"leftabove", 5, FALSE},
52+ {"lockmarks", 3, FALSE},
53+ {"rightbelow", 6, FALSE},
54+ {"sandbox", 3, FALSE},
55+ {"silent", 3, FALSE},
56+ {"tab", 3, TRUE},
57+ {"topleft", 2, FALSE},
58+ {"verbose", 4, TRUE},
59+ {"vertical", 4, FALSE},
60+ };
61+
62+ /*
63+ * Return length of a command modifier (including optional count).
64+ * Return zero when it's not a modifier.
65+ */
66+ int
67+ modifier_len(cmd)
68+ char_u *cmd;
69+ {
70+ int i, j;
71+ char_u *p = cmd;
72+
73+ if (VIM_ISDIGIT(*cmd))
74+ p = skipwhite(skipdigits(cmd));
75+ for (i = 0; i < sizeof(cmdmods) / sizeof(struct cmdmod); ++i)
76+ {
77+ for (j = 0; p[j] != NUL; ++j)
78+ if (p[j] != cmdmods[i].name[j])
79+ break;
80+ if (!isalpha(p[j]) && j >= cmdmods[i].minlen
81+ && (p == cmd || cmdmods[i].has_count))
82+ return j + (p - cmd);
83+ }
84+ return 0;
85+ }
86+
87 /*
88 * Return > 0 if an Ex command "name" exists.
89 * Return 2 if there is an exact match.
90***************
91*** 2977,3006 ****
92 int i;
93 int j;
94 char_u *p;
95- static struct cmdmod
96- {
97- char *name;
98- int minlen;
99- } cmdmods[] = {
100- {"aboveleft", 3},
101- {"belowright", 3},
102- {"botright", 2},
103- {"browse", 3},
104- {"confirm", 4},
105- {"hide", 3},
106- {"keepalt", 5},
107- {"keepjumps", 5},
108- {"keepmarks", 3},
109- {"leftabove", 5},
110- {"lockmarks", 3},
111- {"rightbelow", 6},
112- {"sandbox", 3},
113- {"silent", 3},
114- {"tab", 3},
115- {"topleft", 2},
116- {"verbose", 4},
117- {"vertical", 4},
118- };
119
120 /* Check command modifiers. */
121 for (i = 0; i < sizeof(cmdmods) / sizeof(struct cmdmod); ++i)
122--- 3028,3033 ----
123*** ../vim-7.1.161/src/ex_eval.c Wed Aug 1 15:47:06 2007
124--- src/ex_eval.c Sat Nov 24 16:34:09 2007
125***************
126*** 2269,2277 ****
127 has_loop_cmd(p)
128 char_u *p;
129 {
130! p = skipwhite(p);
131! while (*p == ':')
132! p = skipwhite(p + 1);
133 if ((p[0] == 'w' && p[1] == 'h')
134 || (p[0] == 'f' && p[1] == 'o' && p[2] == 'r'))
135 return TRUE;
136--- 2269,2286 ----
137 has_loop_cmd(p)
138 char_u *p;
139 {
140! int len;
141!
142! /* skip modifiers, white space and ':' */
143! for (;;)
144! {
145! while (*p == ' ' || *p == '\t' || *p == ':')
146! ++p;
147! len = modifier_len(p);
148! if (len == 0)
149! break;
150! p += len;
151! }
152 if ((p[0] == 'w' && p[1] == 'h')
153 || (p[0] == 'f' && p[1] == 'o' && p[2] == 'r'))
154 return TRUE;
155*** ../vim-7.1.161/src/version.c Sat Nov 24 21:27:33 2007
156--- src/version.c Sat Nov 24 21:48:38 2007
157***************
158*** 668,669 ****
159--- 668,671 ----
160 { /* Add new patch number below this line */
161+ /**/
162+ 162,
163 /**/
164
165--
166hundred-and-one symptoms of being an internet addict:
167144. You eagerly await the update of the "Cool Site of the Day."
168
169 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
170/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
171\\\ download, build and distribute -- http://www.A-A-P.org ///
172 \\\ help me help AIDS victims -- http://ICCF-Holland.org ///
This page took 0.04159 seconds and 4 git commands to generate.