4 From: Bram Moolenaar <Bram@moolenaar.net>
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
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,
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
22 ap = first_autopat[(int)event];
25 - if (pattern == NULL)
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;
36 /* Check if there is an autocommand with the given pattern. */
38 ap = first_autopat[(int)event];
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;
47 /* Check if there is an autocommand with the given pattern. */
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))
60 /* For buffer-local autocommands, fnamecmp() works fine. */
61 if (ap->pat != NULL && ap->cmds != NULL
62 && (group == AUGROUP_ALL || ap->group == group)
64 ! || (buflocal_buf == NULL
65 ! ? fnamecmp(ap->pat, pattern) == 0
66 ! : ap->buflocal_nr == buflocal_buf->b_fnum)))
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
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
79 SCRIPTS_GUI = test16.out
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
87 SCRIPTS_GUI = test16.out
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
94 + Test that groups and patterns are tested correctly when calling exists() for
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"))
108 + :au BufEnter * let g:entered=1
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>"))
121 + :call append(0, results)
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
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
147 { /* Add new patch number below this line */
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.
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 ///