summaryrefslogtreecommitdiff
path: root/data/vim/patches/8.1.0397
blob: 3fab4180c62ce20df52aa1ba6a0a9dbb7076d977 (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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
To: vim_dev@googlegroups.com
Subject: Patch 8.1.0397
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------

Patch 8.1.0397
Problem:    No event triggered after updating diffs.
Solution:   Add the DiffUpdated event.
Files:      src/vim.h, src/diff.c, src/fileio.c,
            src/testdir/test_diffmode.vim, runtime/doc/autocmd.txt


*** ../vim-8.1.0396/src/vim.h	2018-09-13 17:26:31.091401618 +0200
--- src/vim.h	2018-09-16 15:28:57.984413860 +0200
***************
*** 1251,1354 ****
   */
  enum auto_event
  {
!     EVENT_BUFADD = 0,		/* after adding a buffer to the buffer list */
!     EVENT_BUFDELETE,		/* deleting a buffer from the buffer list */
!     EVENT_BUFENTER,		/* after entering a buffer */
!     EVENT_BUFFILEPOST,		/* after renaming a buffer */
!     EVENT_BUFFILEPRE,		/* before renaming a buffer */
!     EVENT_BUFHIDDEN,		/* just after buffer becomes hidden */
!     EVENT_BUFLEAVE,		/* before leaving a buffer */
!     EVENT_BUFNEW,		/* after creating any buffer */
!     EVENT_BUFNEWFILE,		/* when creating a buffer for a new file */
!     EVENT_BUFREADCMD,		/* read buffer using command */
!     EVENT_BUFREADPOST,		/* after reading a buffer */
!     EVENT_BUFREADPRE,		/* before reading a buffer */
!     EVENT_BUFUNLOAD,		/* just before unloading a buffer */
!     EVENT_BUFWINENTER,		/* after showing a buffer in a window */
!     EVENT_BUFWINLEAVE,		/* just after buffer removed from window */
!     EVENT_BUFWIPEOUT,		/* just before really deleting a buffer */
!     EVENT_BUFWRITECMD,		/* write buffer using command */
!     EVENT_BUFWRITEPOST,		/* after writing a buffer */
!     EVENT_BUFWRITEPRE,		/* before writing a buffer */
!     EVENT_CMDLINECHANGED,	/* command line was modified*/
!     EVENT_CMDLINEENTER,		/* after entering the command line */
!     EVENT_CMDLINELEAVE,		/* before leaving the command line */
!     EVENT_CMDUNDEFINED,		/* command undefined */
!     EVENT_CMDWINENTER,		/* after entering the cmdline window */
!     EVENT_CMDWINLEAVE,		/* before leaving the cmdline window */
!     EVENT_COLORSCHEME,		/* after loading a colorscheme */
!     EVENT_COLORSCHEMEPRE,	/* before loading a colorscheme */
!     EVENT_COMPLETEDONE,		/* after finishing insert complete */
!     EVENT_CURSORHOLD,		/* cursor in same position for a while */
!     EVENT_CURSORHOLDI,		/* idem, in Insert mode */
!     EVENT_CURSORMOVED,		/* cursor was moved */
!     EVENT_CURSORMOVEDI,		/* cursor was moved in Insert mode */
!     EVENT_DIRCHANGED,		/* after user changed directory */
!     EVENT_ENCODINGCHANGED,	/* after changing the 'encoding' option */
!     EVENT_EXITPRE,		/* before exiting */
!     EVENT_FILEAPPENDCMD,	/* append to a file using command */
!     EVENT_FILEAPPENDPOST,	/* after appending to a file */
!     EVENT_FILEAPPENDPRE,	/* before appending to a file */
!     EVENT_FILECHANGEDRO,	/* before first change to read-only file */
!     EVENT_FILECHANGEDSHELL,	/* after shell command that changed file */
!     EVENT_FILECHANGEDSHELLPOST,	/* after (not) reloading changed file */
!     EVENT_FILEREADCMD,		/* read from a file using command */
!     EVENT_FILEREADPOST,		/* after reading a file */
!     EVENT_FILEREADPRE,		/* before reading a file */
!     EVENT_FILETYPE,		/* new file type detected (user defined) */
!     EVENT_FILEWRITECMD,		/* write to a file using command */
!     EVENT_FILEWRITEPOST,	/* after writing a file */
!     EVENT_FILEWRITEPRE,		/* before writing a file */
!     EVENT_FILTERREADPOST,	/* after reading from a filter */
!     EVENT_FILTERREADPRE,	/* before reading from a filter */
!     EVENT_FILTERWRITEPOST,	/* after writing to a filter */
!     EVENT_FILTERWRITEPRE,	/* before writing to a filter */
!     EVENT_FOCUSGAINED,		/* got the focus */
!     EVENT_FOCUSLOST,		/* lost the focus to another app */
!     EVENT_FUNCUNDEFINED,	/* if calling a function which doesn't exist */
!     EVENT_GUIENTER,		/* after starting the GUI */
!     EVENT_GUIFAILED,		/* after starting the GUI failed */
!     EVENT_INSERTCHANGE,		/* when changing Insert/Replace mode */
!     EVENT_INSERTCHARPRE,	/* before inserting a char */
!     EVENT_INSERTENTER,		/* when entering Insert mode */
!     EVENT_INSERTLEAVE,		/* when leaving Insert mode */
!     EVENT_MENUPOPUP,		/* just before popup menu is displayed */
!     EVENT_OPTIONSET,		/* option was set */
!     EVENT_QUICKFIXCMDPOST,	/* after :make, :grep etc. */
!     EVENT_QUICKFIXCMDPRE,	/* before :make, :grep etc. */
!     EVENT_QUITPRE,		/* before :quit */
!     EVENT_REMOTEREPLY,		/* upon string reception from a remote vim */
!     EVENT_SESSIONLOADPOST,	/* after loading a session file */
!     EVENT_SHELLCMDPOST,		/* after ":!cmd" */
!     EVENT_SHELLFILTERPOST,	/* after ":1,2!cmd", ":w !cmd", ":r !cmd". */
!     EVENT_SOURCECMD,		/* sourcing a Vim script using command */
!     EVENT_SOURCEPRE,		/* before sourcing a Vim script */
!     EVENT_SPELLFILEMISSING,	/* spell file missing */
!     EVENT_STDINREADPOST,	/* after reading from stdin */
!     EVENT_STDINREADPRE,		/* before reading from stdin */
!     EVENT_SWAPEXISTS,		/* found existing swap file */
!     EVENT_SYNTAX,		/* syntax selected */
!     EVENT_TABCLOSED,		/* after closing a tab page */
!     EVENT_TABENTER,		/* after entering a tab page */
!     EVENT_TABLEAVE,		/* before leaving a tab page */
!     EVENT_TABNEW,		/* when entering a new tab page */
!     EVENT_TERMCHANGED,		/* after changing 'term' */
!     EVENT_TERMINALOPEN,		/* after a terminal buffer was created */
!     EVENT_TERMRESPONSE,		/* after setting "v:termresponse" */
!     EVENT_TEXTCHANGED,		/* text was modified not in Insert mode */
!     EVENT_TEXTCHANGEDI,         /* text was modified in Insert mode */
!     EVENT_TEXTCHANGEDP,         /* TextChangedI with popup menu visible */
!     EVENT_TEXTYANKPOST,		/* after some text was yanked */
!     EVENT_USER,			/* user defined autocommand */
!     EVENT_VIMENTER,		/* after starting Vim */
!     EVENT_VIMLEAVE,		/* before exiting Vim */
!     EVENT_VIMLEAVEPRE,		/* before exiting Vim and writing .viminfo */
!     EVENT_VIMRESIZED,		/* after Vim window was resized */
!     EVENT_WINENTER,		/* after entering a window */
!     EVENT_WINLEAVE,		/* before leaving a window */
!     EVENT_WINNEW,		/* when entering a new window */
  
!     NUM_EVENTS			/* MUST be the last one */
  };
  
  typedef enum auto_event event_T;
--- 1251,1355 ----
   */
  enum auto_event
  {
!     EVENT_BUFADD = 0,		// after adding a buffer to the buffer list
!     EVENT_BUFDELETE,		// deleting a buffer from the buffer list
!     EVENT_BUFENTER,		// after entering a buffer
!     EVENT_BUFFILEPOST,		// after renaming a buffer
!     EVENT_BUFFILEPRE,		// before renaming a buffer
!     EVENT_BUFHIDDEN,		// just after buffer becomes hidden
!     EVENT_BUFLEAVE,		// before leaving a buffer
!     EVENT_BUFNEW,		// after creating any buffer
!     EVENT_BUFNEWFILE,		// when creating a buffer for a new file
!     EVENT_BUFREADCMD,		// read buffer using command
!     EVENT_BUFREADPOST,		// after reading a buffer
!     EVENT_BUFREADPRE,		// before reading a buffer
!     EVENT_BUFUNLOAD,		// just before unloading a buffer
!     EVENT_BUFWINENTER,		// after showing a buffer in a window
!     EVENT_BUFWINLEAVE,		// just after buffer removed from window
!     EVENT_BUFWIPEOUT,		// just before really deleting a buffer
!     EVENT_BUFWRITECMD,		// write buffer using command
!     EVENT_BUFWRITEPOST,		// after writing a buffer
!     EVENT_BUFWRITEPRE,		// before writing a buffer
!     EVENT_CMDLINECHANGED,	// command line was modified*/
!     EVENT_CMDLINEENTER,		// after entering the command line
!     EVENT_CMDLINELEAVE,		// before leaving the command line
!     EVENT_CMDUNDEFINED,		// command undefined
!     EVENT_CMDWINENTER,		// after entering the cmdline window
!     EVENT_CMDWINLEAVE,		// before leaving the cmdline window
!     EVENT_COLORSCHEME,		// after loading a colorscheme
!     EVENT_COLORSCHEMEPRE,	// before loading a colorscheme
!     EVENT_COMPLETEDONE,		// after finishing insert complete
!     EVENT_CURSORHOLD,		// cursor in same position for a while
!     EVENT_CURSORHOLDI,		// idem, in Insert mode
!     EVENT_CURSORMOVED,		// cursor was moved
!     EVENT_CURSORMOVEDI,		// cursor was moved in Insert mode
!     EVENT_DIFFUPDATED,		// after diffs were updated
!     EVENT_DIRCHANGED,		// after user changed directory
!     EVENT_ENCODINGCHANGED,	// after changing the 'encoding' option
!     EVENT_EXITPRE,		// before exiting
!     EVENT_FILEAPPENDCMD,	// append to a file using command
!     EVENT_FILEAPPENDPOST,	// after appending to a file
!     EVENT_FILEAPPENDPRE,	// before appending to a file
!     EVENT_FILECHANGEDRO,	// before first change to read-only file
!     EVENT_FILECHANGEDSHELL,	// after shell command that changed file
!     EVENT_FILECHANGEDSHELLPOST,	// after (not) reloading changed file
!     EVENT_FILEREADCMD,		// read from a file using command
!     EVENT_FILEREADPOST,		// after reading a file
!     EVENT_FILEREADPRE,		// before reading a file
!     EVENT_FILETYPE,		// new file type detected (user defined)
!     EVENT_FILEWRITECMD,		// write to a file using command
!     EVENT_FILEWRITEPOST,	// after writing a file
!     EVENT_FILEWRITEPRE,		// before writing a file
!     EVENT_FILTERREADPOST,	// after reading from a filter
!     EVENT_FILTERREADPRE,	// before reading from a filter
!     EVENT_FILTERWRITEPOST,	// after writing to a filter
!     EVENT_FILTERWRITEPRE,	// before writing to a filter
!     EVENT_FOCUSGAINED,		// got the focus
!     EVENT_FOCUSLOST,		// lost the focus to another app
!     EVENT_FUNCUNDEFINED,	// if calling a function which doesn't exist
!     EVENT_GUIENTER,		// after starting the GUI
!     EVENT_GUIFAILED,		// after starting the GUI failed
!     EVENT_INSERTCHANGE,		// when changing Insert/Replace mode
!     EVENT_INSERTCHARPRE,	// before inserting a char
!     EVENT_INSERTENTER,		// when entering Insert mode
!     EVENT_INSERTLEAVE,		// when leaving Insert mode
!     EVENT_MENUPOPUP,		// just before popup menu is displayed
!     EVENT_OPTIONSET,		// option was set
!     EVENT_QUICKFIXCMDPOST,	// after :make, :grep etc.
!     EVENT_QUICKFIXCMDPRE,	// before :make, :grep etc.
!     EVENT_QUITPRE,		// before :quit
!     EVENT_REMOTEREPLY,		// upon string reception from a remote vim
!     EVENT_SESSIONLOADPOST,	// after loading a session file
!     EVENT_SHELLCMDPOST,		// after ":!cmd"
!     EVENT_SHELLFILTERPOST,	// after ":1,2!cmd", ":w !cmd", ":r !cmd".
!     EVENT_SOURCECMD,		// sourcing a Vim script using command
!     EVENT_SOURCEPRE,		// before sourcing a Vim script
!     EVENT_SPELLFILEMISSING,	// spell file missing
!     EVENT_STDINREADPOST,	// after reading from stdin
!     EVENT_STDINREADPRE,		// before reading from stdin
!     EVENT_SWAPEXISTS,		// found existing swap file
!     EVENT_SYNTAX,		// syntax selected
!     EVENT_TABCLOSED,		// after closing a tab page
!     EVENT_TABENTER,		// after entering a tab page
!     EVENT_TABLEAVE,		// before leaving a tab page
!     EVENT_TABNEW,		// when entering a new tab page
!     EVENT_TERMCHANGED,		// after changing 'term'
!     EVENT_TERMINALOPEN,		// after a terminal buffer was created
!     EVENT_TERMRESPONSE,		// after setting "v:termresponse"
!     EVENT_TEXTCHANGED,		// text was modified not in Insert mode
!     EVENT_TEXTCHANGEDI,         // text was modified in Insert mode
!     EVENT_TEXTCHANGEDP,         // TextChangedI with popup menu visible
!     EVENT_TEXTYANKPOST,		// after some text was yanked
!     EVENT_USER,			// user defined autocommand
!     EVENT_VIMENTER,		// after starting Vim
!     EVENT_VIMLEAVE,		// before exiting Vim
!     EVENT_VIMLEAVEPRE,		// before exiting Vim and writing .viminfo
!     EVENT_VIMRESIZED,		// after Vim window was resized
!     EVENT_WINENTER,		// after entering a window
!     EVENT_WINLEAVE,		// before leaving a window
!     EVENT_WINNEW,		// when entering a new window
  
!     NUM_EVENTS			// MUST be the last one
  };
  
  typedef enum auto_event event_T;
*** ../vim-8.1.0396/src/diff.c	2018-09-16 14:51:34.003406787 +0200
--- src/diff.c	2018-09-16 15:29:52.787858129 +0200
***************
*** 942,947 ****
--- 942,949 ----
      curwin->w_valid_cursor.lnum = 0;
  
      diff_redraw(TRUE);
+ 
+     apply_autocmds(EVENT_DIFFUPDATED, NULL, NULL, FALSE, curbuf);
  }
  
  /*
*** ../vim-8.1.0396/src/fileio.c	2018-09-13 15:33:39.605712221 +0200
--- src/fileio.c	2018-09-16 15:30:10.519679152 +0200
***************
*** 7761,7766 ****
--- 7761,7767 ----
      {"CursorHoldI",	EVENT_CURSORHOLDI},
      {"CursorMoved",	EVENT_CURSORMOVED},
      {"CursorMovedI",	EVENT_CURSORMOVEDI},
+     {"DiffUpdated",	EVENT_DIFFUPDATED},
      {"DirChanged",	EVENT_DIRCHANGED},
      {"EncodingChanged",	EVENT_ENCODINGCHANGED},
      {"ExitPre",		EVENT_EXITPRE},
*** ../vim-8.1.0396/src/testdir/test_diffmode.vim	2018-09-15 19:17:07.510653263 +0200
--- src/testdir/test_diffmode.vim	2018-09-16 15:42:46.704283160 +0200
***************
*** 4,9 ****
--- 4,12 ----
  
  func Test_diff_fold_sync()
    enew!
+   let g:update_count = 0
+   au DiffUpdated * let g:update_count += 1
+ 
    let l = range(50)
    call setline(1, l)
    diffthis
***************
*** 29,34 ****
--- 32,40 ----
    call win_gotoid(winone)
    call assert_equal(23, getcurpos()[1])
  
+   call assert_equal(1, g:update_count)
+   au! DiffUpdated
+ 
    windo diffoff
    close!
    set nomodified
*** ../vim-8.1.0396/runtime/doc/autocmd.txt	2018-05-17 13:40:51.000000000 +0200
--- runtime/doc/autocmd.txt	2018-09-16 15:46:22.166221491 +0200
***************
*** 656,667 ****
  							*E881*
  				If the number of lines changes saving for undo
  				may fail and the change will be aborted.
  							*DirChanged*
  DirChanged			The working directory has changed in response
  				to the |:cd| or |:lcd| commands, or as a
  				result of the 'autochdir' option.
  				The pattern can be:
! 					"window" to trigger on `:lcd
  					"global" to trigger on `:cd`
  					"auto"   to trigger on 'autochdir'.
  					"drop"	 to trigger on editing a file
--- 656,672 ----
  							*E881*
  				If the number of lines changes saving for undo
  				may fail and the change will be aborted.
+ 							*DiffUpdated*
+ DiffUpdated			After diffs have been updated.  Depending on
+ 				what kind of diff is being used (internal or
+ 				external) this can be triggered on every
+ 				change or when doing |:diffupdate|.
  							*DirChanged*
  DirChanged			The working directory has changed in response
  				to the |:cd| or |:lcd| commands, or as a
  				result of the 'autochdir' option.
  				The pattern can be:
! 					"window" to trigger on `:lcd`
  					"global" to trigger on `:cd`
  					"auto"   to trigger on 'autochdir'.
  					"drop"	 to trigger on editing a file
*** ../vim-8.1.0396/src/version.c	2018-09-16 15:14:15.078419097 +0200
--- src/version.c	2018-09-16 15:44:10.039484480 +0200
***************
*** 796,797 ****
--- 796,799 ----
  {   /* Add new patch number below this line */
+ /**/
+     397,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
67. Your hard drive crashes. You haven't logged in for two hours.  You start
    to twitch. You pick up the phone and manually dial your ISP's access
    number. You try to hum to communicate with the modem.  You succeed.

 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///