summaryrefslogtreecommitdiffstats
path: root/gvim/vim-7.2/7.2.259
blob: 0bf0ba1332cec6c6d45ed589e25cfcdd9659d5f5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
To: vim-dev@vim.org
Subject: Patch 7.2.259
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------

Patch 7.2.259
Problem:    exists() doesn't work properly for an empty aucmd group.
Solution:   Change how au_exists() handles a missing pattern.  Also add a
	    test for this. (Bob Hiestand)
Files:	    src/fileio.c, src/testdir/Makefile, src/testdir/test67.in,
	    src/testdir/test67.ok


*** ../vim-7.2.258/src/fileio.c	2009-09-11 15:04:13.000000000 +0200
--- src/fileio.c	2009-09-11 16:37:08.000000000 +0200
***************
*** 9498,9512 ****
      ap = first_autopat[(int)event];
      if (ap == NULL)
  	goto theend;
-     if (pattern == NULL)
-     {
- 	retval = TRUE;
- 	goto theend;
-     }
  
      /* if pattern is "<buffer>", special handling is needed which uses curbuf */
      /* for pattern "<buffer=N>, fnamecmp() will work fine */
!     if (STRICMP(pattern, "<buffer>") == 0)
  	buflocal_buf = curbuf;
  
      /* Check if there is an autocommand with the given pattern. */
--- 9498,9507 ----
      ap = first_autopat[(int)event];
      if (ap == NULL)
  	goto theend;
  
      /* if pattern is "<buffer>", special handling is needed which uses curbuf */
      /* for pattern "<buffer=N>, fnamecmp() will work fine */
!     if (pattern != NULL && STRICMP(pattern, "<buffer>") == 0)
  	buflocal_buf = curbuf;
  
      /* Check if there is an autocommand with the given pattern. */
***************
*** 9515,9523 ****
  	/* For buffer-local autocommands, fnamecmp() works fine. */
  	if (ap->pat != NULL && ap->cmds != NULL
  	    && (group == AUGROUP_ALL || ap->group == group)
! 	    && (buflocal_buf == NULL
! 		 ? fnamecmp(ap->pat, pattern) == 0
! 		 : ap->buflocal_nr == buflocal_buf->b_fnum))
  	{
  	    retval = TRUE;
  	    break;
--- 9510,9519 ----
  	/* For buffer-local autocommands, fnamecmp() works fine. */
  	if (ap->pat != NULL && ap->cmds != NULL
  	    && (group == AUGROUP_ALL || ap->group == group)
! 	    && (pattern == NULL
! 		|| (buflocal_buf == NULL
! 		    ? fnamecmp(ap->pat, pattern) == 0
! 		    : ap->buflocal_nr == buflocal_buf->b_fnum)))
  	{
  	    retval = TRUE;
  	    break;
*** ../vim-7.2.258/src/testdir/Makefile	2009-06-24 18:07:55.000000000 +0200
--- src/testdir/Makefile	2009-09-11 16:31:33.000000000 +0200
***************
*** 22,28 ****
  		test48.out test49.out test51.out test52.out test53.out \
  		test54.out test55.out test56.out test57.out test58.out \
  		test59.out test60.out test61.out test62.out test63.out \
! 		test64.out test65.out test66.out
  
  SCRIPTS_GUI = test16.out
  
--- 22,28 ----
  		test48.out test49.out test51.out test52.out test53.out \
  		test54.out test55.out test56.out test57.out test58.out \
  		test59.out test60.out test61.out test62.out test63.out \
! 		test64.out test65.out test66.out test67.out
  
  SCRIPTS_GUI = test16.out
  
*** ../vim-7.2.258/src/testdir/test67.in	2009-09-11 17:23:47.000000000 +0200
--- src/testdir/test67.in	2009-09-11 16:43:11.000000000 +0200
***************
*** 0 ****
--- 1,33 ----
+ Test that groups and patterns are tested correctly when calling exists() for
+ autocommands.
+ 
+ STARTTEST
+ :so small.vim
+ :let results=[]
+ :augroup auexists
+ :augroup END
+ :call add(results, "##BufEnter: " . exists("##BufEnter"))
+ :call add(results, "#BufEnter: " . exists("#BufEnter"))
+ :au BufEnter * let g:entered=1
+ :call add(results, "#BufEnter: " . exists("#BufEnter"))
+ :call add(results, "#auexists#BufEnter: " . exists("#auexists#BufEnter"))
+ :augroup auexists
+ :au BufEnter * let g:entered=1
+ :augroup END
+ :call add(results, "#auexists#BufEnter: " . exists("#auexists#BufEnter"))
+ :call add(results, "#BufEnter#*.test: " . exists("#BufEnter#*.test"))
+ :au BufEnter *.test let g:entered=1
+ :call add(results, "#BufEnter#*.test: " . exists("#BufEnter#*.test"))
+ :edit testfile.test
+ :call add(results, "#BufEnter#<buffer>: " . exists("#BufEnter#<buffer>"))
+ :au BufEnter <buffer> let g:entered=1
+ :call add(results, "#BufEnter#<buffer>: " . exists("#BufEnter#<buffer>"))
+ :edit testfile2.test
+ :call add(results, "#BufEnter#<buffer>: " . exists("#BufEnter#<buffer>"))
+ :e test.out
+ :call append(0, results)
+ :$d
+ :w
+ :qa!
+ ENDTEST
+ 
*** ../vim-7.2.258/src/testdir/test67.ok	2009-09-11 17:23:47.000000000 +0200
--- src/testdir/test67.ok	2009-09-11 16:43:15.000000000 +0200
***************
*** 0 ****
--- 1,10 ----
+ ##BufEnter: 1
+ #BufEnter: 0
+ #BufEnter: 1
+ #auexists#BufEnter: 0
+ #auexists#BufEnter: 1
+ #BufEnter#*.test: 0
+ #BufEnter#*.test: 1
+ #BufEnter#<buffer>: 0
+ #BufEnter#<buffer>: 1
+ #BufEnter#<buffer>: 0
*** ../vim-7.2.258/src/version.c	2009-09-11 16:48:06.000000000 +0200
--- src/version.c	2009-09-11 17:23:14.000000000 +0200
***************
*** 678,679 ****
--- 678,681 ----
  {   /* Add new patch number below this line */
+ /**/
+     259,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
234. You started college as a chemistry major, and walk out four years
     later as an Internet provider.

 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\        download, build and distribute -- http://www.A-A-P.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///