]>
Commit | Line | Data |
---|---|---|
4ff12b6a ER |
1 | To: vim-dev@vim.org |
2 | Subject: Patch 7.2.259 | |
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.2.259 | |
11 | Problem: exists() doesn't work properly for an empty aucmd group. | |
12 | Solution: Change how au_exists() handles a missing pattern. Also add a | |
13 | test for this. (Bob Hiestand) | |
14 | Files: src/fileio.c, src/testdir/Makefile, src/testdir/test67.in, | |
15 | src/testdir/test67.ok | |
16 | ||
17 | ||
18 | *** ../vim-7.2.258/src/fileio.c 2009-09-11 15:04:13.000000000 +0200 | |
19 | --- src/fileio.c 2009-09-11 16:37:08.000000000 +0200 | |
20 | *************** | |
21 | *** 9498,9512 **** | |
22 | ap = first_autopat[(int)event]; | |
23 | if (ap == NULL) | |
24 | goto theend; | |
25 | - if (pattern == NULL) | |
26 | - { | |
27 | - retval = TRUE; | |
28 | - goto theend; | |
29 | - } | |
30 | ||
31 | /* if pattern is "<buffer>", special handling is needed which uses curbuf */ | |
32 | /* for pattern "<buffer=N>, fnamecmp() will work fine */ | |
33 | ! if (STRICMP(pattern, "<buffer>") == 0) | |
34 | buflocal_buf = curbuf; | |
35 | ||
36 | /* Check if there is an autocommand with the given pattern. */ | |
37 | --- 9498,9507 ---- | |
38 | ap = first_autopat[(int)event]; | |
39 | if (ap == NULL) | |
40 | goto theend; | |
41 | ||
42 | /* if pattern is "<buffer>", special handling is needed which uses curbuf */ | |
43 | /* for pattern "<buffer=N>, fnamecmp() will work fine */ | |
44 | ! if (pattern != NULL && STRICMP(pattern, "<buffer>") == 0) | |
45 | buflocal_buf = curbuf; | |
46 | ||
47 | /* Check if there is an autocommand with the given pattern. */ | |
48 | *************** | |
49 | *** 9515,9523 **** | |
50 | /* For buffer-local autocommands, fnamecmp() works fine. */ | |
51 | if (ap->pat != NULL && ap->cmds != NULL | |
52 | && (group == AUGROUP_ALL || ap->group == group) | |
53 | ! && (buflocal_buf == NULL | |
54 | ! ? fnamecmp(ap->pat, pattern) == 0 | |
55 | ! : ap->buflocal_nr == buflocal_buf->b_fnum)) | |
56 | { | |
57 | retval = TRUE; | |
58 | break; | |
59 | --- 9510,9519 ---- | |
60 | /* For buffer-local autocommands, fnamecmp() works fine. */ | |
61 | if (ap->pat != NULL && ap->cmds != NULL | |
62 | && (group == AUGROUP_ALL || ap->group == group) | |
63 | ! && (pattern == NULL | |
64 | ! || (buflocal_buf == NULL | |
65 | ! ? fnamecmp(ap->pat, pattern) == 0 | |
66 | ! : ap->buflocal_nr == buflocal_buf->b_fnum))) | |
67 | { | |
68 | retval = TRUE; | |
69 | break; | |
70 | *** ../vim-7.2.258/src/testdir/Makefile 2009-06-24 18:07:55.000000000 +0200 | |
71 | --- src/testdir/Makefile 2009-09-11 16:31:33.000000000 +0200 | |
72 | *************** | |
73 | *** 22,28 **** | |
74 | test48.out test49.out test51.out test52.out test53.out \ | |
75 | test54.out test55.out test56.out test57.out test58.out \ | |
76 | test59.out test60.out test61.out test62.out test63.out \ | |
77 | ! test64.out test65.out test66.out | |
78 | ||
79 | SCRIPTS_GUI = test16.out | |
80 | ||
81 | --- 22,28 ---- | |
82 | test48.out test49.out test51.out test52.out test53.out \ | |
83 | test54.out test55.out test56.out test57.out test58.out \ | |
84 | test59.out test60.out test61.out test62.out test63.out \ | |
85 | ! test64.out test65.out test66.out test67.out | |
86 | ||
87 | SCRIPTS_GUI = test16.out | |
88 | ||
89 | *** ../vim-7.2.258/src/testdir/test67.in 2009-09-11 17:23:47.000000000 +0200 | |
90 | --- src/testdir/test67.in 2009-09-11 16:43:11.000000000 +0200 | |
91 | *************** | |
92 | *** 0 **** | |
93 | --- 1,33 ---- | |
94 | + Test that groups and patterns are tested correctly when calling exists() for | |
95 | + autocommands. | |
96 | + | |
97 | + STARTTEST | |
98 | + :so small.vim | |
99 | + :let results=[] | |
100 | + :augroup auexists | |
101 | + :augroup END | |
102 | + :call add(results, "##BufEnter: " . exists("##BufEnter")) | |
103 | + :call add(results, "#BufEnter: " . exists("#BufEnter")) | |
104 | + :au BufEnter * let g:entered=1 | |
105 | + :call add(results, "#BufEnter: " . exists("#BufEnter")) | |
106 | + :call add(results, "#auexists#BufEnter: " . exists("#auexists#BufEnter")) | |
107 | + :augroup auexists | |
108 | + :au BufEnter * let g:entered=1 | |
109 | + :augroup END | |
110 | + :call add(results, "#auexists#BufEnter: " . exists("#auexists#BufEnter")) | |
111 | + :call add(results, "#BufEnter#*.test: " . exists("#BufEnter#*.test")) | |
112 | + :au BufEnter *.test let g:entered=1 | |
113 | + :call add(results, "#BufEnter#*.test: " . exists("#BufEnter#*.test")) | |
114 | + :edit testfile.test | |
115 | + :call add(results, "#BufEnter#<buffer>: " . exists("#BufEnter#<buffer>")) | |
116 | + :au BufEnter <buffer> let g:entered=1 | |
117 | + :call add(results, "#BufEnter#<buffer>: " . exists("#BufEnter#<buffer>")) | |
118 | + :edit testfile2.test | |
119 | + :call add(results, "#BufEnter#<buffer>: " . exists("#BufEnter#<buffer>")) | |
120 | + :e test.out | |
121 | + :call append(0, results) | |
122 | + :$d | |
123 | + :w | |
124 | + :qa! | |
125 | + ENDTEST | |
126 | + | |
127 | *** ../vim-7.2.258/src/testdir/test67.ok 2009-09-11 17:23:47.000000000 +0200 | |
128 | --- src/testdir/test67.ok 2009-09-11 16:43:15.000000000 +0200 | |
129 | *************** | |
130 | *** 0 **** | |
131 | --- 1,10 ---- | |
132 | + ##BufEnter: 1 | |
133 | + #BufEnter: 0 | |
134 | + #BufEnter: 1 | |
135 | + #auexists#BufEnter: 0 | |
136 | + #auexists#BufEnter: 1 | |
137 | + #BufEnter#*.test: 0 | |
138 | + #BufEnter#*.test: 1 | |
139 | + #BufEnter#<buffer>: 0 | |
140 | + #BufEnter#<buffer>: 1 | |
141 | + #BufEnter#<buffer>: 0 | |
142 | *** ../vim-7.2.258/src/version.c 2009-09-11 16:48:06.000000000 +0200 | |
143 | --- src/version.c 2009-09-11 17:23:14.000000000 +0200 | |
144 | *************** | |
145 | *** 678,679 **** | |
146 | --- 678,681 ---- | |
147 | { /* Add new patch number below this line */ | |
148 | + /**/ | |
149 | + 259, | |
150 | /**/ | |
151 | ||
152 | -- | |
153 | hundred-and-one symptoms of being an internet addict: | |
154 | 234. You started college as a chemistry major, and walk out four years | |
155 | later as an Internet provider. | |
156 | ||
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 /// |