source: patches/vim-7.0-fixes-10.patch@ a3b6c75

clfs-1.2 clfs-2.1 clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since a3b6c75 was f74ae22, checked in by Jim Gifford <clfs@…>, 18 years ago

Updated Patches

  • Property mode set to 100644
File size: 63.8 KB
RevLine 
[f74ae22]1Submitted By: Jim Gifford (jim at linuxfromscratch dot org)
2Date: 2006-08-27
3Initial Package Version: 7.0
4Origin: Upstream
5Upstream Status: Applied
6Description: Contains Patch 001-004, 006-026, 028-031, 033-044, 036-056,
7 058-064, and 066 from Upstream
8 005, 027, 032, 045, 057, and 066 is for the extras, Mac, or
9 Windows 32 only
10
11diff -Naur vim70.orig/configure vim70/configure
12--- vim70.orig/configure 2004-07-05 02:02:24.000000000 -0700
13+++ vim70/configure 2006-08-09 08:37:06.000000000 -0700
14@@ -3,4 +3,4 @@
15 # This is just a stub for the Unix configure script, to provide support for
16 # doing "./configure" in the top Vim directory.
17
18-cd src && ./configure "$@"
19+cd src && exec ./configure "$@"
20diff -Naur vim70.orig/runtime/autoload/ccomplete.vim vim70/runtime/autoload/ccomplete.vim
21--- vim70.orig/runtime/autoload/ccomplete.vim 2006-05-03 07:35:56.000000000 -0700
22+++ vim70/runtime/autoload/ccomplete.vim 2006-07-14 08:51:21.000000000 -0700
23@@ -1,7 +1,7 @@
24 " Vim completion script
25 " Language: C
26 " Maintainer: Bram Moolenaar <Bram@vim.org>
27-" Last Change: 2006 May 03
28+" Last Change: 2006 May 08
29
30
31 " This function is used for the 'omnifunc' option.
32@@ -458,7 +458,7 @@
33 " member.
34 function! s:StructMembers(typename, items, all)
35 " Todo: What about local structures?
36- let fnames = join(map(tagfiles(), 'escape(v:val, " \\")'))
37+ let fnames = join(map(tagfiles(), 'escape(v:val, " \\#%")'))
38 if fnames == ''
39 return []
40 endif
41diff -Naur vim70.orig/runtime/autoload/gzip.vim vim70/runtime/autoload/gzip.vim
42--- vim70.orig/runtime/autoload/gzip.vim 2006-03-31 07:12:15.000000000 -0800
43+++ vim70/runtime/autoload/gzip.vim 2006-08-09 08:37:36.000000000 -0700
44@@ -1,6 +1,6 @@
45 " Vim autoload file for editing compressed files.
46 " Maintainer: Bram Moolenaar <Bram@vim.org>
47-" Last Change: 2006 Mar 31
48+" Last Change: 2006 Jul 19
49
50 " These functions are used by the gzip plugin.
51
52@@ -127,9 +127,9 @@
53 let nmt = s:tempname(nm)
54 if rename(nm, nmt) == 0
55 if exists("b:gzip_comp_arg")
56- call system(a:cmd . " " . b:gzip_comp_arg . " " . nmt)
57+ call system(a:cmd . " " . b:gzip_comp_arg . " '" . nmt . "'")
58 else
59- call system(a:cmd . " " . nmt)
60+ call system(a:cmd . " '" . nmt . "'")
61 endif
62 call rename(nmt . "." . expand("<afile>:e"), nm)
63 endif
64diff -Naur vim70.orig/runtime/autoload/paste.vim vim70/runtime/autoload/paste.vim
65--- vim70.orig/runtime/autoload/paste.vim 2006-04-21 11:31:01.000000000 -0700
66+++ vim70/runtime/autoload/paste.vim 2006-07-14 08:51:21.000000000 -0700
67@@ -1,6 +1,6 @@
68 " Vim support file to help with paste mappings and menus
69 " Maintainer: Bram Moolenaar <Bram@vim.org>
70-" Last Change: 2006 Apr 21
71+" Last Change: 2006 Jun 23
72
73 " Define the string to use for items that are present both in Edit, Popup and
74 " Toolbar menu. Also used in mswin.vim and macmap.vim.
75@@ -12,7 +12,7 @@
76 if has("virtualedit")
77 let paste#paste_cmd = {'n': ":call paste#Paste()<CR>"}
78 let paste#paste_cmd['v'] = '"-c<Esc>' . paste#paste_cmd['n']
79- let paste#paste_cmd['i'] = '<Esc>' . paste#paste_cmd['n'] . 'gi'
80+ let paste#paste_cmd['i'] = 'x<BS><Esc>' . paste#paste_cmd['n'] . 'gi'
81
82 func! paste#Paste()
83 let ove = &ve
84diff -Naur vim70.orig/runtime/autoload/spellfile.vim vim70/runtime/autoload/spellfile.vim
85--- vim70.orig/runtime/autoload/spellfile.vim 2006-02-01 04:12:24.000000000 -0800
86+++ vim70/runtime/autoload/spellfile.vim 2006-07-14 08:51:21.000000000 -0700
87@@ -1,9 +1,9 @@
88 " Vim script to download a missing spell file
89 " Maintainer: Bram Moolenaar <Bram@vim.org>
90-" Last Change: 2006 Feb 01
91+" Last Change: 2006 May 10
92
93 if !exists('g:spellfile_URL')
94- let g:spellfile_URL = 'ftp://ftp.vim.org/pub/vim/unstable/runtime/spell'
95+ let g:spellfile_URL = 'ftp://ftp.vim.org/pub/vim/runtime/spell'
96 endif
97 let s:spellfile_URL = '' " Start with nothing so that s:donedict is reset.
98
99@@ -61,13 +61,13 @@
100 new
101 setlocal bin
102 echo 'Downloading ' . fname . '...'
103- exe 'Nread ' g:spellfile_URL . '/' . fname
104+ call spellfile#Nread(fname)
105 if getline(2) !~ 'VIMspell'
106 " Didn't work, perhaps there is an ASCII one.
107 g/^/d
108 let fname = a:lang . '.ascii.spl'
109 echo 'Could not find it, trying ' . fname . '...'
110- exe 'Nread ' g:spellfile_URL . '/' . fname
111+ call spellfile#Nread(fname)
112 if getline(2) !~ 'VIMspell'
113 echo 'Sorry, downloading failed'
114 bwipe!
115@@ -95,7 +95,7 @@
116 g/^/d
117 let fname = substitute(fname, '\.spl$', '.sug', '')
118 echo 'Downloading ' . fname . '...'
119- exe 'Nread ' g:spellfile_URL . '/' . fname
120+ call spellfile#Nread(fname)
121 if getline(2) !~ 'VIMsug'
122 echo 'Sorry, downloading failed'
123 else
124@@ -109,3 +109,10 @@
125 bwipe
126 endif
127 endfunc
128+
129+" Read "fname" from the ftp server.
130+function! spellfile#Nread(fname)
131+ let machine = substitute(g:spellfile_URL, 'ftp://\([^/]*\).*', '\1', '')
132+ let dir = substitute(g:spellfile_URL, 'ftp://[^/]*/\(.*\)', '\1', '')
133+ exe 'Nread "' . machine . ' anonymous vim7user ' . dir . '/' . a:fname . '"'
134+endfunc
135diff -Naur vim70.orig/runtime/plugin/matchparen.vim vim70/runtime/plugin/matchparen.vim
136--- vim70.orig/runtime/plugin/matchparen.vim 2006-04-27 06:31:26.000000000 -0700
137+++ vim70/runtime/plugin/matchparen.vim 2006-08-09 08:36:40.000000000 -0700
138@@ -1,6 +1,6 @@
139 " Vim plugin for showing matching parens
140 " Maintainer: Bram Moolenaar <Bram@vim.org>
141-" Last Change: 2006 Apr 27
142+" Last Change: 2006 Jun 26
143
144 " Exit quickly when:
145 " - this plugin was already loaded (or disabled)
146@@ -90,19 +90,19 @@
147 " Find the match. When it was just before the cursor move it there for a
148 " moment.
149 if before > 0
150- let save_cursor = getpos('.')
151+ let save_cursor = winsaveview()
152 call cursor(c_lnum, c_col - before)
153 endif
154
155 " When not in a string or comment ignore matches inside them.
156 let s_skip ='synIDattr(synID(line("."), col("."), 0), "name") ' .
157- \ '=~? "string\\|comment"'
158+ \ '=~? "string\\|character\\|singlequote\\|comment"'
159 execute 'if' s_skip '| let s_skip = 0 | endif'
160
161 let [m_lnum, m_col] = searchpairpos(c, '', c2, s_flags, s_skip, stopline)
162
163 if before > 0
164- call setpos('.', save_cursor)
165+ call winrestview(save_cursor)
166 endif
167
168 " If a match is found setup match highlighting.
169diff -Naur vim70.orig/runtime/scripts.vim vim70/runtime/scripts.vim
170--- vim70.orig/runtime/scripts.vim 2006-03-28 11:30:49.000000000 -0800
171+++ vim70/runtime/scripts.vim 2006-08-09 08:38:04.000000000 -0700
172@@ -1,7 +1,7 @@
173 " Vim support file to detect file types in scripts
174 "
175 " Maintainer: Bram Moolenaar <Bram@vim.org>
176-" Last change: 2006 Mar 28
177+" Last change: 2006 Jul 08
178
179 " This file is called by an autocommand for every file that has just been
180 " loaded into a buffer. It checks if the type of file can be recognized by
181@@ -54,6 +54,12 @@
182 let s:name = substitute(s:line1, '^#!\s*\S*[/\\]\(\i\+\).*', '\1', '')
183 endif
184
185+ " tcl scripts may have #!/bin/sh in the first line and "exec wish" in the
186+ " third line. Suggested by Steven Atkinson.
187+ if getline(3) =~ '^exec wish'
188+ let s:name = 'wish'
189+ endif
190+
191 " Bourne-like shell scripts: bash bash2 ksh ksh93 sh
192 if s:name =~ '^\(bash\d*\|\|ksh\d*\|sh\)\>'
193 call SetFileTypeSH(s:line1) " defined in filetype.vim
194diff -Naur vim70.orig/src/buffer.c vim70/src/buffer.c
195--- vim70.orig/src/buffer.c 2006-04-26 14:37:23.000000000 -0700
196+++ vim70/src/buffer.c 2006-08-19 16:39:01.000000000 -0700
197@@ -5420,11 +5420,7 @@
198 buf_T *newbuf;
199 int differ = TRUE;
200 linenr_T lnum;
201-#ifdef FEAT_AUTOCMD
202 aco_save_T aco;
203-#else
204- buf_T *old_curbuf = curbuf;
205-#endif
206 exarg_T ea;
207
208 /* Allocate a buffer without putting it in the buffer list. */
209@@ -5439,13 +5435,8 @@
210 return TRUE;
211 }
212
213-#ifdef FEAT_AUTOCMD
214 /* set curwin/curbuf to buf and save a few things */
215 aucmd_prepbuf(&aco, newbuf);
216-#else
217- curbuf = newbuf;
218- curwin->w_buffer = newbuf;
219-#endif
220
221 if (ml_open(curbuf) == OK
222 && readfile(buf->b_ffname, buf->b_fname,
223@@ -5466,13 +5457,8 @@
224 }
225 vim_free(ea.cmd);
226
227-#ifdef FEAT_AUTOCMD
228 /* restore curwin/curbuf and a few other things */
229 aucmd_restbuf(&aco);
230-#else
231- curbuf = old_curbuf;
232- curwin->w_buffer = old_curbuf;
233-#endif
234
235 if (curbuf != newbuf) /* safety check */
236 wipe_buffer(newbuf, FALSE);
237diff -Naur vim70.orig/src/configure vim70/src/configure
238--- vim70.orig/src/configure 2006-05-07 07:17:49.000000000 -0700
239+++ vim70/src/configure 2006-08-09 08:37:06.000000000 -0700
240@@ -2,5 +2,9 @@
241 # run the automatically generated configure script
242 CONFIG_STATUS=auto/config.status \
243 auto/configure "$@" --srcdir="${srcdir:-.}" --cache-file=auto/config.cache
244+result=$?
245+
246 # Stupid autoconf 2.5x causes this file to be left behind.
247 if test -f configure.lineno; then rm -f configure.lineno; fi
248+
249+exit $result
250diff -Naur vim70.orig/src/edit.c vim70/src/edit.c
251--- vim70.orig/src/edit.c 2006-05-07 04:48:51.000000000 -0700
252+++ vim70/src/edit.c 2006-08-27 12:47:33.000000000 -0700
253@@ -719,9 +719,14 @@
254 #ifdef FEAT_INS_EXPAND
255 /*
256 * Special handling of keys while the popup menu is visible or wanted
257- * and the cursor is still in the completed word.
258+ * and the cursor is still in the completed word. Only when there is
259+ * a match, skip this when no matches were found.
260 */
261- if (compl_started && pum_wanted() && curwin->w_cursor.col >= compl_col)
262+ if (compl_started
263+ && pum_wanted()
264+ && curwin->w_cursor.col >= compl_col
265+ && (compl_shown_match == NULL
266+ || compl_shown_match != compl_shown_match->cp_next))
267 {
268 /* BS: Delete one character from "compl_leader". */
269 if ((c == K_BS || c == Ctrl_H)
270@@ -751,7 +756,7 @@
271 continue;
272 }
273
274- /* Pressing CTRL-Y selects the current match. Shen
275+ /* Pressing CTRL-Y selects the current match. When
276 * compl_enter_selects is set the Enter key does the same. */
277 if (c == Ctrl_Y || (compl_enter_selects
278 && (c == CAR || c == K_KENTER || c == NL)))
279@@ -877,6 +882,7 @@
280 /* Close the cmdline window. */
281 cmdwin_result = K_IGNORE;
282 got_int = FALSE; /* don't stop executing autocommands et al. */
283+ nomove = TRUE;
284 goto doESCkey;
285 }
286 #endif
287@@ -2409,6 +2415,7 @@
288 compl_matches = ins_compl_make_cyclic();
289 compl_started = TRUE;
290 compl_used_match = TRUE;
291+ compl_cont_status = 0;
292
293 compl_curr_match = compl_first_match;
294 ins_complete(Ctrl_N);
295@@ -2753,6 +2760,7 @@
296 }
297 else
298 # endif
299+ if (count > 0) /* avoid warning for using "files" uninit */
300 {
301 ins_compl_files(count, files, thesaurus, flags,
302 &regmatch, buf, &dir);
303@@ -3015,9 +3023,6 @@
304 if ((int)(p - line) - (int)compl_col <= 0)
305 return K_BS;
306
307- /* For redo we need to repeat this backspace. */
308- AppendCharToRedobuff(K_BS);
309-
310 /* Deleted more than what was used to find matches or didn't finish
311 * finding all matches: need to look for matches all over again. */
312 if (curwin->w_cursor.col <= compl_col + compl_length
313@@ -3046,7 +3051,6 @@
314 ins_compl_delete();
315 ins_bytes(compl_leader + curwin->w_cursor.col - compl_col);
316 compl_used_match = FALSE;
317- compl_enter_selects = FALSE;
318
319 if (compl_started)
320 ins_compl_set_original_text(compl_leader);
321@@ -3076,6 +3080,7 @@
322 compl_restarting = FALSE;
323 }
324
325+#if 0 /* disabled, made CTRL-L, BS and typing char jump to original text. */
326 if (!compl_used_match)
327 {
328 /* Go to the original text, since none of the matches is inserted. */
329@@ -3087,6 +3092,8 @@
330 compl_curr_match = compl_shown_match;
331 compl_shows_dir = compl_direction;
332 }
333+#endif
334+ compl_enter_selects = !compl_used_match;
335
336 /* Show the popup menu with a different set of matches. */
337 ins_compl_show_pum();
338@@ -3115,10 +3122,6 @@
339 #endif
340 ins_char(c);
341
342- /* For redo we need to count this character so that the number of
343- * backspaces is correct. */
344- AppendCharToRedobuff(c);
345-
346 /* If we didn't complete finding matches we must search again. */
347 if (compl_was_interrupted)
348 ins_compl_restart();
349@@ -3175,10 +3178,32 @@
350 char_u *p;
351 int len = curwin->w_cursor.col - compl_col;
352 int c;
353+ compl_T *cp;
354
355 p = compl_shown_match->cp_str;
356 if ((int)STRLEN(p) <= len) /* the match is too short */
357- return;
358+ {
359+ /* When still at the original match use the first entry that matches
360+ * the leader. */
361+ if (compl_shown_match->cp_flags & ORIGINAL_TEXT)
362+ {
363+ p = NULL;
364+ for (cp = compl_shown_match->cp_next; cp != NULL
365+ && cp != compl_first_match; cp = cp->cp_next)
366+ {
367+ if (ins_compl_equal(cp, compl_leader,
368+ (int)STRLEN(compl_leader)))
369+ {
370+ p = cp->cp_str;
371+ break;
372+ }
373+ }
374+ if (p == NULL || (int)STRLEN(p) <= len)
375+ return;
376+ }
377+ else
378+ return;
379+ }
380 p += len;
381 #ifdef FEAT_MBYTE
382 c = mb_ptr2char(p);
383@@ -3198,7 +3223,6 @@
384 int c;
385 {
386 char_u *ptr;
387- int temp;
388 int want_cindent;
389 int retval = FALSE;
390
391@@ -3354,6 +3378,7 @@
392 if (compl_curr_match != NULL || compl_leader != NULL || c == Ctrl_E)
393 {
394 char_u *p;
395+ int temp = 0;
396
397 /*
398 * If any of the original typed text has been changed, eg when
399@@ -3369,16 +3394,21 @@
400 ptr = compl_leader;
401 else
402 ptr = compl_orig_text;
403- p = compl_orig_text;
404- for (temp = 0; p[temp] != NUL && p[temp] == ptr[temp]; ++temp)
405- ;
406+ if (compl_orig_text != NULL)
407+ {
408+ p = compl_orig_text;
409+ for (temp = 0; p[temp] != NUL && p[temp] == ptr[temp];
410+ ++temp)
411+ ;
412 #ifdef FEAT_MBYTE
413- if (temp > 0)
414- temp -= (*mb_head_off)(compl_orig_text, p + temp);
415+ if (temp > 0)
416+ temp -= (*mb_head_off)(compl_orig_text, p + temp);
417 #endif
418- for (p += temp; *p != NUL; mb_ptr_adv(p))
419- AppendCharToRedobuff(K_BS);
420- AppendToRedobuffLit(ptr + temp, -1);
421+ for (p += temp; *p != NUL; mb_ptr_adv(p))
422+ AppendCharToRedobuff(K_BS);
423+ }
424+ if (ptr != NULL)
425+ AppendToRedobuffLit(ptr + temp, -1);
426 }
427
428 #ifdef FEAT_CINDENT
429@@ -4100,6 +4130,21 @@
430 && compl_shown_match->cp_next != NULL
431 && compl_shown_match->cp_next != compl_first_match)
432 compl_shown_match = compl_shown_match->cp_next;
433+
434+ /* If we didn't find it searching forward, and compl_shows_dir is
435+ * backward, find the last match. */
436+ if (compl_shows_dir == BACKWARD
437+ && !ins_compl_equal(compl_shown_match,
438+ compl_leader, (int)STRLEN(compl_leader))
439+ && (compl_shown_match->cp_next == NULL
440+ || compl_shown_match->cp_next == compl_first_match))
441+ {
442+ while (!ins_compl_equal(compl_shown_match,
443+ compl_leader, (int)STRLEN(compl_leader))
444+ && compl_shown_match->cp_prev != NULL
445+ && compl_shown_match->cp_prev != compl_first_match)
446+ compl_shown_match = compl_shown_match->cp_prev;
447+ }
448 }
449
450 if (allow_get_expansion && insert_match
451@@ -4124,8 +4169,6 @@
452 {
453 if (compl_shows_dir == FORWARD && compl_shown_match->cp_next != NULL)
454 {
455- if (compl_pending != 0)
456- --compl_pending;
457 compl_shown_match = compl_shown_match->cp_next;
458 found_end = (compl_first_match != NULL
459 && (compl_shown_match->cp_next == compl_first_match
460@@ -4134,14 +4177,24 @@
461 else if (compl_shows_dir == BACKWARD
462 && compl_shown_match->cp_prev != NULL)
463 {
464- if (compl_pending != 0)
465- ++compl_pending;
466 found_end = (compl_shown_match == compl_first_match);
467 compl_shown_match = compl_shown_match->cp_prev;
468 found_end |= (compl_shown_match == compl_first_match);
469 }
470 else
471 {
472+ if (!allow_get_expansion)
473+ {
474+ if (advance)
475+ {
476+ if (compl_shows_dir == BACKWARD)
477+ compl_pending -= todo + 1;
478+ else
479+ compl_pending += todo + 1;
480+ }
481+ return -1;
482+ }
483+
484 if (advance)
485 {
486 if (compl_shows_dir == BACKWARD)
487@@ -4149,14 +4202,27 @@
488 else
489 ++compl_pending;
490 }
491- if (!allow_get_expansion)
492- return -1;
493
494 /* Find matches. */
495 num_matches = ins_compl_get_exp(&compl_startpos);
496- if (compl_pending != 0 && compl_direction == compl_shows_dir
497+
498+ /* handle any pending completions */
499+ while (compl_pending != 0 && compl_direction == compl_shows_dir
500 && advance)
501- compl_shown_match = compl_curr_match;
502+ {
503+ if (compl_pending > 0 && compl_shown_match->cp_next != NULL)
504+ {
505+ compl_shown_match = compl_shown_match->cp_next;
506+ --compl_pending;
507+ }
508+ if (compl_pending < 0 && compl_shown_match->cp_prev != NULL)
509+ {
510+ compl_shown_match = compl_shown_match->cp_prev;
511+ ++compl_pending;
512+ }
513+ else
514+ break;
515+ }
516 found_end = FALSE;
517 }
518 if ((compl_shown_match->cp_flags & ORIGINAL_TEXT) == 0
519@@ -4265,9 +4331,9 @@
520 return;
521 count = 0;
522
523- ++no_mapping;
524+ /* Check for a typed key. Do use mappings, otherwise vim_is_ctrl_x_key()
525+ * can't do its work correctly. */
526 c = vpeekc_any();
527- --no_mapping;
528 if (c != NUL)
529 {
530 if (vim_is_ctrl_x_key(c) && c != Ctrl_X && c != Ctrl_R)
531@@ -4277,12 +4343,27 @@
532 (void)ins_compl_next(FALSE, ins_compl_key2count(c),
533 c != K_UP && c != K_DOWN);
534 }
535- else if (c != Ctrl_R)
536- compl_interrupted = TRUE;
537+ else
538+ {
539+ /* Need to get the character to have KeyTyped set. We'll put it
540+ * back with vungetc() below. */
541+ c = safe_vgetc();
542+
543+ /* Don't interrupt completion when the character wasn't typed,
544+ * e.g., when doing @q to replay keys. */
545+ if (c != Ctrl_R && KeyTyped)
546+ compl_interrupted = TRUE;
547+
548+ vungetc(c);
549+ }
550 }
551 if (compl_pending != 0 && !got_int)
552- (void)ins_compl_next(FALSE, compl_pending > 0
553- ? compl_pending : -compl_pending, TRUE);
554+ {
555+ int todo = compl_pending > 0 ? compl_pending : -compl_pending;
556+
557+ compl_pending = 0;
558+ (void)ins_compl_next(FALSE, todo, TRUE);
559+ }
560 }
561
562 /*
563@@ -4611,10 +4692,12 @@
564 (int)STRLEN(compl_pattern), curs_col);
565 if (compl_xp.xp_context == EXPAND_UNSUCCESSFUL
566 || compl_xp.xp_context == EXPAND_NOTHING)
567- return FAIL;
568- startcol = (int)(compl_xp.xp_pattern - compl_pattern);
569- compl_col = startcol;
570- compl_length = curs_col - startcol;
571+ /* No completion possible, use an empty pattern to get a
572+ * "pattern not found" message. */
573+ compl_col = curs_col;
574+ else
575+ compl_col = (int)(compl_xp.xp_pattern - compl_pattern);
576+ compl_length = curs_col - compl_col;
577 }
578 else if (ctrl_x_mode == CTRL_X_FUNCTION || ctrl_x_mode == CTRL_X_OMNI)
579 {
580@@ -4668,11 +4751,17 @@
581 else
582 compl_col = spell_word_start(startcol);
583 if (compl_col >= (colnr_T)startcol)
584- return FAIL;
585- spell_expand_check_cap(compl_col);
586+ {
587+ compl_length = 0;
588+ compl_col = curs_col;
589+ }
590+ else
591+ {
592+ spell_expand_check_cap(compl_col);
593+ compl_length = (int)curs_col - compl_col;
594+ }
595 /* Need to obtain "line" again, it may have become invalid. */
596 line = ml_get(curwin->w_cursor.lnum);
597- compl_length = (int)curs_col - compl_col;
598 compl_pattern = vim_strnsave(line + compl_col, compl_length);
599 if (compl_pattern == NULL)
600 #endif
601diff -Naur vim70.orig/src/eval.c vim70/src/eval.c
602--- vim70.orig/src/eval.c 2006-05-05 10:15:26.000000000 -0700
603+++ vim70/src/eval.c 2006-08-19 16:40:29.000000000 -0700
604@@ -8252,6 +8252,12 @@
605 EMSG(_("E785: complete() can only be used in Insert mode"));
606 return;
607 }
608+
609+ /* Check for undo allowed here, because if something was already inserted
610+ * the line was already saved for undo and this check isn't done. */
611+ if (!undo_allowed())
612+ return;
613+
614 if (argvars[1].v_type != VAR_LIST || argvars[1].vval.v_list == NULL)
615 {
616 EMSG(_(e_invarg));
617@@ -9792,6 +9798,9 @@
618 varnumber_T n;
619 int error = FALSE;
620
621+ /* Position the cursor. Needed after a message that ends in a space. */
622+ windgoto(msg_row, msg_col);
623+
624 ++no_mapping;
625 ++allow_keys;
626 if (argvars[0].v_type == VAR_UNKNOWN)
627@@ -11312,14 +11321,19 @@
628
629 static int inputsecret_flag = 0;
630
631+static void get_user_input __ARGS((typval_T *argvars, typval_T *rettv, int inputdialog));
632+
633 /*
634- * "input()" function
635- * Also handles inputsecret() when inputsecret is set.
636+ * This function is used by f_input() and f_inputdialog() functions. The third
637+ * argument to f_input() specifies the type of completion to use at the
638+ * prompt. The third argument to f_inputdialog() specifies the value to return
639+ * when the user cancels the prompt.
640 */
641 static void
642-f_input(argvars, rettv)
643+get_user_input(argvars, rettv, inputdialog)
644 typval_T *argvars;
645 typval_T *rettv;
646+ int inputdialog;
647 {
648 char_u *prompt = get_tv_string_chk(&argvars[0]);
649 char_u *p = NULL;
650@@ -11369,10 +11383,10 @@
651 if (defstr != NULL)
652 stuffReadbuffSpec(defstr);
653
654- if (argvars[2].v_type != VAR_UNKNOWN)
655+ if (!inputdialog && argvars[2].v_type != VAR_UNKNOWN)
656 {
657 char_u *xp_name;
658- int xp_namelen;
659+ int xp_namelen;
660 long argt;
661
662 rettv->vval.v_string = NULL;
663@@ -11404,6 +11418,18 @@
664 }
665
666 /*
667+ * "input()" function
668+ * Also handles inputsecret() when inputsecret is set.
669+ */
670+ static void
671+f_input(argvars, rettv)
672+ typval_T *argvars;
673+ typval_T *rettv;
674+{
675+ get_user_input(argvars, rettv, FALSE);
676+}
677+
678+/*
679 * "inputdialog()" function
680 */
681 static void
682@@ -11443,7 +11469,7 @@
683 }
684 else
685 #endif
686- f_input(argvars, rettv);
687+ get_user_input(argvars, rettv, TRUE);
688 }
689
690 /*
691@@ -11471,6 +11497,7 @@
692 }
693
694 msg_start();
695+ msg_row = Rows - 1; /* for when 'cmdheight' > 1 */
696 lines_left = Rows; /* avoid more prompt */
697 msg_scroll = TRUE;
698 msg_clr_eos();
699@@ -13250,7 +13277,7 @@
700 if (argvars[2].v_type != VAR_UNKNOWN)
701 EMSG2(_(e_toomanyarg), "remove()");
702 else if ((d = argvars[0].vval.v_dict) != NULL
703- && !tv_check_lock(d->dv_lock, (char_u *)"remove()"))
704+ && !tv_check_lock(d->dv_lock, (char_u *)"remove() argument"))
705 {
706 key = get_tv_string_chk(&argvars[1]);
707 if (key != NULL)
708@@ -13270,7 +13297,7 @@
709 else if (argvars[0].v_type != VAR_LIST)
710 EMSG2(_(e_listdictarg), "remove()");
711 else if ((l = argvars[0].vval.v_list) != NULL
712- && !tv_check_lock(l->lv_lock, (char_u *)"remove()"))
713+ && !tv_check_lock(l->lv_lock, (char_u *)"remove() argument"))
714 {
715 int error = FALSE;
716
717@@ -14157,11 +14184,7 @@
718 typval_T *rettv;
719 {
720 buf_T *buf;
721-#ifdef FEAT_AUTOCMD
722 aco_save_T aco;
723-#else
724- buf_T *save_curbuf;
725-#endif
726 char_u *varname, *bufvarname;
727 typval_T *varp;
728 char_u nbuf[NUMBUFLEN];
729@@ -14178,12 +14201,7 @@
730 if (buf != NULL && varname != NULL && varp != NULL)
731 {
732 /* set curbuf to be our buf, temporarily */
733-#ifdef FEAT_AUTOCMD
734 aucmd_prepbuf(&aco, buf);
735-#else
736- save_curbuf = curbuf;
737- curbuf = buf;
738-#endif
739
740 if (*varname == '&')
741 {
742@@ -14210,11 +14228,7 @@
743 }
744
745 /* reset notion of buffer */
746-#ifdef FEAT_AUTOCMD
747 aucmd_restbuf(&aco);
748-#else
749- curbuf = save_curbuf;
750-#endif
751 }
752 }
753
754@@ -16438,9 +16452,12 @@
755 long i = 0;
756 long n;
757
758- /* List must be: [fnum, lnum, col, coladd] */
759- if (arg->v_type != VAR_LIST || l == NULL
760- || l->lv_len != (fnump == NULL ? 3 : 4))
761+ /* List must be: [fnum, lnum, col, coladd], where "fnum" is only there
762+ * when "fnump" isn't NULL and "coladd" is optional. */
763+ if (arg->v_type != VAR_LIST
764+ || l == NULL
765+ || l->lv_len < (fnump == NULL ? 2 : 3)
766+ || l->lv_len > (fnump == NULL ? 3 : 4))
767 return FAIL;
768
769 if (fnump != NULL)
770@@ -16466,8 +16483,9 @@
771 #ifdef FEAT_VIRTUALEDIT
772 n = list_find_nr(l, i, NULL);
773 if (n < 0)
774- return FAIL;
775- posp->coladd = n;
776+ posp->coladd = 0;
777+ else
778+ posp->coladd = n;
779 #endif
780
781 return OK;
782@@ -17759,6 +17777,13 @@
783 }
784 else /* add a new variable */
785 {
786+ /* Can't add "v:" variable. */
787+ if (ht == &vimvarht)
788+ {
789+ EMSG2(_(e_illvar), name);
790+ return;
791+ }
792+
793 /* Make sure the variable name is valid. */
794 for (p = varname; *p != NUL; ++p)
795 if (!eval_isnamec1(*p) && (p == varname || !VIM_ISDIGIT(*p))
796@@ -18786,6 +18811,7 @@
797 if (dict_add(fudi.fd_dict, fudi.fd_di) == FAIL)
798 {
799 vim_free(fudi.fd_di);
800+ vim_free(fp);
801 goto erret;
802 }
803 }
804@@ -18963,7 +18989,8 @@
805 else if (lead > 0)
806 {
807 lead = 3;
808- if (eval_fname_sid(lv.ll_exp_name != NULL ? lv.ll_exp_name : *pp))
809+ if ((lv.ll_exp_name != NULL && eval_fname_sid(lv.ll_exp_name))
810+ || eval_fname_sid(*pp))
811 {
812 /* It's "s:" or "<SID>" */
813 if (current_SID <= 0)
814@@ -19685,6 +19712,7 @@
815 v->di_tv.vval.v_list = &fc.l_varlist;
816 vim_memset(&fc.l_varlist, 0, sizeof(list_T));
817 fc.l_varlist.lv_refcount = 99999;
818+ fc.l_varlist.lv_lock = VAR_FIXED;
819
820 /*
821 * Set a:firstline to "firstline" and a:lastline to "lastline".
822diff -Naur vim70.orig/src/ex_cmds.h vim70/src/ex_cmds.h
823--- vim70.orig/src/ex_cmds.h 2006-04-07 02:44:46.000000000 -0700
824+++ vim70/src/ex_cmds.h 2006-07-14 08:51:21.000000000 -0700
825@@ -262,7 +262,7 @@
826 EX(CMD_comclear, "comclear", ex_comclear,
827 TRLBAR|CMDWIN),
828 EX(CMD_compiler, "compiler", ex_compiler,
829- BANG|TRLBAR|WORD1),
830+ BANG|TRLBAR|WORD1|CMDWIN),
831 EX(CMD_continue, "continue", ex_continue,
832 TRLBAR|SBOXOK|CMDWIN),
833 EX(CMD_confirm, "confirm", ex_wrongmodifier,
834diff -Naur vim70.orig/src/ex_docmd.c vim70/src/ex_docmd.c
835--- vim70.orig/src/ex_docmd.c 2006-05-05 09:33:19.000000000 -0700
836+++ vim70/src/ex_docmd.c 2006-08-19 16:34:11.000000000 -0700
837@@ -833,7 +833,7 @@
838 * If requested, store and reset the global values controlling the
839 * exception handling (used when debugging).
840 */
841- else if (flags & DOCMD_EXCRESET)
842+ if (flags & DOCMD_EXCRESET)
843 save_dbg_stuff(&debug_saved);
844
845 initial_trylevel = trylevel;
846@@ -1710,6 +1710,10 @@
847 save_cmdmod = cmdmod;
848 vim_memset(&cmdmod, 0, sizeof(cmdmod));
849
850+ /* "#!anything" is handled like a comment. */
851+ if ((*cmdlinep)[0] == '#' && (*cmdlinep)[1] == '!')
852+ goto doend;
853+
854 /*
855 * Repeat until no more command modifiers are found.
856 */
857diff -Naur vim70.orig/src/ex_getln.c vim70/src/ex_getln.c
858--- vim70.orig/src/ex_getln.c 2006-04-30 08:32:01.000000000 -0700
859+++ vim70/src/ex_getln.c 2006-08-19 16:33:52.000000000 -0700
860@@ -5982,6 +5982,8 @@
861 typestr[0] = cmdwin_type;
862 typestr[1] = NUL;
863 apply_autocmds(EVENT_CMDWINENTER, typestr, typestr, FALSE, curbuf);
864+ if (restart_edit != 0) /* autocmd with ":startinsert" */
865+ stuffcharReadbuff(K_NOP);
866 # endif
867
868 i = RedrawingDisabled;
869diff -Naur vim70.orig/src/fileio.c vim70/src/fileio.c
870--- vim70.orig/src/fileio.c 2006-04-30 08:28:57.000000000 -0700
871+++ vim70/src/fileio.c 2006-08-19 16:39:01.000000000 -0700
872@@ -6450,17 +6450,10 @@
873 int old_ro = buf->b_p_ro;
874 buf_T *savebuf;
875 int saved = OK;
876-#ifdef FEAT_AUTOCMD
877 aco_save_T aco;
878
879 /* set curwin/curbuf for "buf" and save some things */
880 aucmd_prepbuf(&aco, buf);
881-#else
882- buf_T *save_curbuf = curbuf;
883-
884- curbuf = buf;
885- curwin->w_buffer = buf;
886-#endif
887
888 /* We only want to read the text from the file, not reset the syntax
889 * highlighting, clear marks, diff status, etc. Force the fileformat
890@@ -6573,14 +6566,9 @@
891 curbuf->b_p_ro |= old_ro;
892 }
893
894-#ifdef FEAT_AUTOCMD
895 /* restore curwin/curbuf and a few other things */
896 aucmd_restbuf(&aco);
897 /* Careful: autocommands may have made "buf" invalid! */
898-#else
899- curwin->w_buffer = save_curbuf;
900- curbuf = save_curbuf;
901-#endif
902 }
903
904 /*ARGSUSED*/
905@@ -8088,6 +8076,7 @@
906 * Search a window for the current buffer. Save the cursor position and
907 * screen offset.
908 * Set "curbuf" and "curwin" to match "buf".
909+ * When FEAT_AUTOCMD is not defined another version is used, see below.
910 */
911 void
912 aucmd_prepbuf(aco, buf)
913@@ -8151,6 +8140,7 @@
914 /*
915 * Cleanup after executing autocommands for a (hidden) buffer.
916 * Restore the window as it was (if possible).
917+ * When FEAT_AUTOCMD is not defined another version is used, see below.
918 */
919 void
920 aucmd_restbuf(aco)
921@@ -9063,8 +9053,38 @@
922 return retval;
923 }
924
925+#else /* FEAT_AUTOCMD */
926+
927+/*
928+ * Prepare for executing commands for (hidden) buffer "buf".
929+ * This is the non-autocommand version, it simply saves "curbuf" and sets
930+ * "curbuf" and "curwin" to match "buf".
931+ */
932+ void
933+aucmd_prepbuf(aco, buf)
934+ aco_save_T *aco; /* structure to save values in */
935+ buf_T *buf; /* new curbuf */
936+{
937+ aco->save_buf = buf;
938+ curbuf = buf;
939+ curwin->w_buffer = buf;
940+}
941+
942+/*
943+ * Restore after executing commands for a (hidden) buffer.
944+ * This is the non-autocommand version.
945+ */
946+ void
947+aucmd_restbuf(aco)
948+ aco_save_T *aco; /* structure holding saved values */
949+{
950+ curbuf = aco->save_buf;
951+ curwin->w_buffer = curbuf;
952+}
953+
954 #endif /* FEAT_AUTOCMD */
955
956+
957 #if defined(FEAT_AUTOCMD) || defined(FEAT_WILDIGN) || defined(PROTO)
958 /*
959 * Try matching a filename with a "pattern" ("prog" is NULL), or use the
960diff -Naur vim70.orig/src/gui_at_fs.c vim70/src/gui_at_fs.c
961--- vim70.orig/src/gui_at_fs.c 2005-07-09 04:30:17.000000000 -0700
962+++ vim70/src/gui_at_fs.c 2006-07-14 08:51:21.000000000 -0700
963@@ -1861,27 +1861,27 @@
964 XtPointer pnew;
965 {
966 SFDir *dir;
967- int nw;
968+ int nw = (int)(long)pnew;
969
970 dir = &(SFdirs[SFdirPtr + (int)(long)n]);
971
972 #ifdef FEAT_GUI_NEXTAW
973- if ((int)(long)pnew < 0)
974+ if (nw < 0)
975 {
976- if ((int)(long)pnew > -SFvScrollHeight)
977- (int)(long)pnew = -1;
978+ if (nw > -SFvScrollHeight)
979+ nw = -1;
980 else
981- (int)(long)pnew = -SFlistSize;
982+ nw = -SFlistSize;
983 }
984- else if ((int)(long)pnew > 0)
985+ else if (nw > 0)
986 {
987- if ((int)(long)pnew < SFvScrollHeight)
988- (int)(long)pnew = 1;
989+ if (nw < SFvScrollHeight)
990+ nw = 1;
991 else
992- (int)(long)pnew = SFlistSize;
993+ nw = SFlistSize;
994 }
995 #endif
996- nw = dir->vOrigin + (int)(long)pnew;
997+ nw += dir->vOrigin;
998
999 if (nw > dir->nEntries - SFlistSize)
1000 nw = dir->nEntries - SFlistSize;
1001@@ -1941,27 +1941,27 @@
1002 XtPointer pnew;
1003 {
1004 SFDir *dir;
1005- int nw;
1006+ int nw = (int)(long)pnew;
1007
1008 dir = &(SFdirs[SFdirPtr + (int)(long)n]);
1009
1010 #ifdef FEAT_GUI_NEXTAW
1011- if ((int)(long)pnew < 0)
1012+ if (nw < 0)
1013 {
1014- if ((int)(long)pnew > -SFhScrollWidth)
1015- (int)(long)pnew = -1;
1016+ if (nw > -SFhScrollWidth)
1017+ nw = -1;
1018 else
1019- (int)(long)pnew = -SFcharsPerEntry;
1020+ nw = -SFcharsPerEntry;
1021 }
1022- else if ((int)(long)pnew > 0)
1023+ else if (nw > 0)
1024 {
1025- if ((int)(long)pnew < SFhScrollWidth)
1026- (int)(long)pnew = 1;
1027+ if (nw < SFhScrollWidth)
1028+ nw = 1;
1029 else
1030- (int)(long)pnew = SFcharsPerEntry;
1031+ nw = SFcharsPerEntry;
1032 }
1033 #endif
1034- nw = dir->hOrigin + (int)(long)pnew;
1035+ nw += dir->hOrigin;
1036
1037 if (nw > dir->nChars - SFcharsPerEntry)
1038 nw = dir->nChars - SFcharsPerEntry;
1039@@ -2038,26 +2038,26 @@
1040 XtPointer client_data;
1041 XtPointer pnew;
1042 {
1043- int nw;
1044+ int nw = (int)(long)pnew;
1045 float f;
1046
1047 #ifdef FEAT_GUI_NEXTAW
1048- if ((int)(long)pnew < 0)
1049+ if (nw < 0)
1050 {
1051- if ((int)(long)pnew > -SFpathScrollWidth)
1052- (int)(long)pnew = -1;
1053+ if (nw > -SFpathScrollWidth)
1054+ nw = -1;
1055 else
1056- (int)(long)pnew = -3;
1057+ nw = -3;
1058 }
1059- else if ((int)(long)pnew > 0)
1060+ else if (nw > 0)
1061 {
1062- if ((int)(long)pnew < SFpathScrollWidth)
1063- (int)(long)pnew = 1;
1064+ if (nw < SFpathScrollWidth)
1065+ nw = 1;
1066 else
1067- (int)(long)pnew = 3;
1068+ nw = 3;
1069 }
1070 #endif
1071- nw = SFdirPtr + (int)(long)pnew;
1072+ nw += SFdirPtr;
1073
1074 if (nw > SFdirEnd - 3)
1075 nw = SFdirEnd - 3;
1076diff -Naur vim70.orig/src/gui.c vim70/src/gui.c
1077--- vim70.orig/src/gui.c 2006-05-03 04:00:59.000000000 -0700
1078+++ vim70/src/gui.c 2006-07-14 08:51:21.000000000 -0700
1079@@ -4515,7 +4515,7 @@
1080 int y;
1081 {
1082 win_T *wp;
1083- char_u st[6];
1084+ char_u st[8];
1085
1086 /* Ignore this while still starting up. */
1087 if (!gui.in_use || gui.starting)
1088@@ -4603,11 +4603,11 @@
1089 /* Don't move the mouse when it's left or right of the Vim window */
1090 if (x < 0 || x > Columns * gui.char_width)
1091 return;
1092+ if (y >= 0
1093 # ifdef FEAT_WINDOWS
1094- if (Y_2_ROW(y) >= tabline_height())
1095-# else
1096- if (y >= 0)
1097+ && Y_2_ROW(y) >= tabline_height()
1098 # endif
1099+ )
1100 wp = xy2win(x, y);
1101 if (wp != curwin && wp != NULL) /* If in other than current window */
1102 {
1103diff -Naur vim70.orig/src/gui_xmebw.c vim70/src/gui_xmebw.c
1104--- vim70.orig/src/gui_xmebw.c 2006-04-30 08:32:32.000000000 -0700
1105+++ vim70/src/gui_xmebw.c 2006-07-14 08:51:21.000000000 -0700
1106@@ -47,13 +47,13 @@
1107 #include "gui_xmebwp.h"
1108
1109 /* Provide some missing wrappers, which are missed from the LessTif
1110- * implementation.
1111+ * implementation. Also missing in Motif 1.2 and earlier.
1112 *
1113 * We neither use XmeGetPixmapData or _XmGetPixmapData, since with LessTif the
1114 * pixmap will not appear in it's caches properly. We cache the interresting
1115 * values in XmEnhancedButtonPart instead ourself.
1116 */
1117-#ifdef LESSTIF_VERSION
1118+#if defined(LESSTIF_VERSION) || (XmVersion <= 1002)
1119 # ifndef Lab_IsMenupane
1120 # define Lab_IsMenupane(w) (Lab_MenuType(w) == (int)XmMENU_POPUP || \
1121 Lab_MenuType(w) == (int)XmMENU_PULLDOWN)
1122@@ -480,7 +480,7 @@
1123 || (eb->core.height <= 2 * eb->primitive.highlight_thickness))
1124 return;
1125
1126-#ifndef LESSTIF_VERSION
1127+#if !defined(LESSTIF_VERSION) && (XmVersion > 1002)
1128 {
1129 XmDisplay dpy;
1130
1131@@ -641,7 +641,7 @@
1132 GC tmp_gc = NULL;
1133 Boolean replaceGC = False;
1134 Boolean deadjusted = False;
1135-#ifndef LESSTIF_VERSION
1136+#if !defined(LESSTIF_VERSION) && (XmVersion > 1002)
1137 XmDisplay dpy = (XmDisplay)XmGetXmDisplay(XtDisplay(eb));
1138 Boolean etched_in = dpy->display.enable_etched_in_menu;
1139 #else
1140@@ -726,7 +726,7 @@
1141 if ((((ShellWidget) XtParent(XtParent(eb)))->shell.popped_up)
1142 && _XmGetInDragMode((Widget) eb))
1143 {
1144-#ifndef LESSTIF_VERSION
1145+#if !defined(LESSTIF_VERSION) && (XmVersion > 1002)
1146 XmDisplay dpy = (XmDisplay) XmGetXmDisplay(XtDisplay(wid));
1147 Boolean etched_in = dpy->display.enable_etched_in_menu;
1148 #else
1149@@ -810,7 +810,7 @@
1150
1151 if (Lab_IsMenupane(eb))
1152 {
1153-#ifndef LESSTIF_VERSION
1154+#if !defined(LESSTIF_VERSION) && (XmVersion > 1002)
1155 XmDisplay dpy = (XmDisplay) XmGetXmDisplay(XtDisplay(wid));
1156 Boolean etched_in = dpy->display.enable_etched_in_menu;
1157 #else
1158@@ -1150,7 +1150,7 @@
1159 Redisplay(Widget w, XEvent *event, Region region)
1160 {
1161 XmEnhancedButtonWidget eb = (XmEnhancedButtonWidget) w;
1162-#ifndef LESSTIF_VERSION
1163+#if !defined(LESSTIF_VERSION) && (XmVersion > 1002)
1164 XmDisplay dpy;
1165 XtEnum default_button_emphasis;
1166 #endif
1167@@ -1162,7 +1162,7 @@
1168 if (!XtIsRealized((Widget)eb))
1169 return;
1170
1171-#ifndef LESSTIF_VERSION
1172+#if !defined(LESSTIF_VERSION) && (XmVersion > 1002)
1173 dpy = (XmDisplay)XmGetXmDisplay(XtDisplay(eb));
1174 default_button_emphasis = dpy->display.default_button_emphasis;
1175 #endif
1176@@ -1241,7 +1241,7 @@
1177 {
1178 int adjust = 0;
1179
1180-#ifndef LESSTIF_VERSION
1181+#if !defined(LESSTIF_VERSION) && (XmVersion > 1002)
1182 /*
1183 * NOTE: PushButton has two types of shadows: primitive-shadow and
1184 * default-button-shadow. If pushbutton is in a menu only primitive
1185@@ -1289,7 +1289,7 @@
1186 adjust, adjust, rectwidth, rectheight, borderwidth);
1187 }
1188
1189-#ifndef LESSTIF_VERSION
1190+#if !defined(LESSTIF_VERSION) && (XmVersion > 1002)
1191 switch (default_button_emphasis)
1192 {
1193 case XmINTERNAL_HIGHLIGHT:
1194@@ -1365,7 +1365,7 @@
1195 default_button_shadow_thickness =
1196 eb->pushbutton.default_button_shadow_thickness;
1197
1198-#ifndef LESSTIF_VERSION
1199+#if !defined(LESSTIF_VERSION) && (XmVersion > 1002)
1200 /*
1201 * Compute location of bounding box to contain the
1202 * defaultButtonShadow.
1203diff -Naur vim70.orig/src/if_perl.xs vim70/src/if_perl.xs
1204--- vim70.orig/src/if_perl.xs 2006-03-06 10:57:16.000000000 -0800
1205+++ vim70/src/if_perl.xs 2006-08-19 16:39:02.000000000 -0700
1206@@ -155,8 +155,8 @@
1207 static int (*perl_run)(PerlInterpreter*);
1208 static int (*perl_parse)(PerlInterpreter*, XSINIT_t, int, char**, char**);
1209 static void* (*Perl_get_context)(void);
1210-static void (*Perl_croak)(pTHX_ const char*, ...) __attribute__((noreturn));
1211-static void (*Perl_croak_nocontext)(const char*, ...) __attribute__((noreturn));
1212+static void (*Perl_croak)(pTHX_ const char*, ...);
1213+static void (*Perl_croak_nocontext)(const char*, ...);
1214 static I32 (*Perl_dowantarray)(pTHX);
1215 static void (*Perl_free_tmps)(pTHX);
1216 static HV* (*Perl_gv_stashpv)(pTHX_ const char*, I32);
1217@@ -1056,7 +1056,6 @@
1218 int i;
1219 long lnum;
1220 char *line;
1221- buf_T *savebuf;
1222 PPCODE:
1223 if (buf_valid(vimbuf))
1224 {
1225@@ -1069,14 +1068,20 @@
1226 line = SvPV(ST(i),PL_na);
1227 if (lnum > 0 && lnum <= vimbuf->b_ml.ml_line_count && line != NULL)
1228 {
1229- savebuf = curbuf;
1230- curbuf = vimbuf;
1231+ aco_save_T aco;
1232+
1233+ /* set curwin/curbuf for "vimbuf" and save some things */
1234+ aucmd_prepbuf(&aco, vimbuf);
1235+
1236 if (u_savesub(lnum) == OK)
1237 {
1238 ml_replace(lnum, (char_u *)line, TRUE);
1239 changed_bytes(lnum, 0);
1240 }
1241- curbuf = savebuf;
1242+
1243+ /* restore curwin/curbuf and a few other things */
1244+ aucmd_restbuf(&aco);
1245+ /* Careful: autocommands may have made "vimbuf" invalid! */
1246 }
1247 }
1248 }
1249@@ -1087,7 +1092,6 @@
1250
1251 PREINIT:
1252 long i, lnum = 0, count = 0;
1253- buf_T *savebuf;
1254 PPCODE:
1255 if (buf_valid(vimbuf))
1256 {
1257@@ -1114,16 +1118,23 @@
1258 {
1259 if (lnum > 0 && lnum <= vimbuf->b_ml.ml_line_count)
1260 {
1261- savebuf = curbuf;
1262- curbuf = vimbuf;
1263+ aco_save_T aco;
1264+
1265+ /* set curwin/curbuf for "vimbuf" and save some things */
1266+ aucmd_prepbuf(&aco, vimbuf);
1267+
1268 if (u_savedel(lnum, 1) == OK)
1269 {
1270 ml_delete(lnum, 0);
1271 deleted_lines_mark(lnum, 1L);
1272- if (savebuf == curbuf)
1273+ if (aco.save_buf == curbuf)
1274 check_cursor();
1275 }
1276- curbuf = savebuf;
1277+
1278+ /* restore curwin/curbuf and a few other things */
1279+ aucmd_restbuf(&aco);
1280+ /* Careful: autocommands may have made "vimbuf" invalid! */
1281+
1282 update_curbuf(VALID);
1283 }
1284 }
1285@@ -1138,7 +1149,6 @@
1286 int i;
1287 long lnum;
1288 char *line;
1289- buf_T *savebuf;
1290 PPCODE:
1291 if (buf_valid(vimbuf))
1292 {
1293@@ -1151,14 +1161,21 @@
1294 line = SvPV(ST(i),PL_na);
1295 if (lnum >= 0 && lnum <= vimbuf->b_ml.ml_line_count && line != NULL)
1296 {
1297- savebuf = curbuf;
1298- curbuf = vimbuf;
1299+ aco_save_T aco;
1300+
1301+ /* set curwin/curbuf for "vimbuf" and save some things */
1302+ aucmd_prepbuf(&aco, vimbuf);
1303+
1304 if (u_inssub(lnum + 1) == OK)
1305 {
1306 ml_append(lnum, (char_u *)line, (colnr_T)0, FALSE);
1307 appended_lines_mark(lnum, 1L);
1308 }
1309- curbuf = savebuf;
1310+
1311+ /* restore curwin/curbuf and a few other things */
1312+ aucmd_restbuf(&aco);
1313+ /* Careful: autocommands may have made "vimbuf" invalid! */
1314+
1315 update_curbuf(VALID);
1316 }
1317 }
1318diff -Naur vim70.orig/src/if_ruby.c vim70/src/if_ruby.c
1319--- vim70.orig/src/if_ruby.c 2006-04-30 08:37:52.000000000 -0700
1320+++ vim70/src/if_ruby.c 2006-08-19 16:39:01.000000000 -0700
1321@@ -643,11 +643,14 @@
1322
1323 static VALUE set_buffer_line(buf_T *buf, linenr_T n, VALUE str)
1324 {
1325- buf_T *savebuf = curbuf;
1326- char *line = STR2CSTR(str);
1327+ char *line = STR2CSTR(str);
1328+ aco_save_T aco;
1329+
1330+ if (n > 0 && n <= buf->b_ml.ml_line_count && line != NULL)
1331+ {
1332+ /* set curwin/curbuf for "buf" and save some things */
1333+ aucmd_prepbuf(&aco, buf);
1334
1335- if (n > 0 && n <= buf->b_ml.ml_line_count && line != NULL) {
1336- curbuf = buf;
1337 if (u_savesub(n) == OK) {
1338 ml_replace(n, (char_u *)line, TRUE);
1339 changed();
1340@@ -655,10 +658,15 @@
1341 syn_changed(n); /* recompute syntax hl. for this line */
1342 #endif
1343 }
1344- curbuf = savebuf;
1345+
1346+ /* restore curwin/curbuf and a few other things */
1347+ aucmd_restbuf(&aco);
1348+ /* Careful: autocommands may have made "buf" invalid! */
1349+
1350 update_curbuf(NOT_VALID);
1351 }
1352- else {
1353+ else
1354+ {
1355 rb_raise(rb_eIndexError, "index %d out of buffer", n);
1356 return Qnil; /* For stop warning */
1357 }
1358@@ -676,12 +684,15 @@
1359
1360 static VALUE buffer_delete(VALUE self, VALUE num)
1361 {
1362- buf_T *buf = get_buf(self);
1363- buf_T *savebuf = curbuf;
1364- long n = NUM2LONG(num);
1365+ buf_T *buf = get_buf(self);
1366+ long n = NUM2LONG(num);
1367+ aco_save_T aco;
1368+
1369+ if (n > 0 && n <= buf->b_ml.ml_line_count)
1370+ {
1371+ /* set curwin/curbuf for "buf" and save some things */
1372+ aucmd_prepbuf(&aco, buf);
1373
1374- if (n > 0 && n <= buf->b_ml.ml_line_count) {
1375- curbuf = buf;
1376 if (u_savedel(n, 1) == OK) {
1377 ml_delete(n, 0);
1378
1379@@ -691,10 +702,15 @@
1380
1381 changed();
1382 }
1383- curbuf = savebuf;
1384+
1385+ /* restore curwin/curbuf and a few other things */
1386+ aucmd_restbuf(&aco);
1387+ /* Careful: autocommands may have made "buf" invalid! */
1388+
1389 update_curbuf(NOT_VALID);
1390 }
1391- else {
1392+ else
1393+ {
1394 rb_raise(rb_eIndexError, "index %d out of buffer", n);
1395 }
1396 return Qnil;
1397@@ -702,13 +718,16 @@
1398
1399 static VALUE buffer_append(VALUE self, VALUE num, VALUE str)
1400 {
1401- buf_T *buf = get_buf(self);
1402- buf_T *savebuf = curbuf;
1403- char *line = STR2CSTR(str);
1404- long n = NUM2LONG(num);
1405+ buf_T *buf = get_buf(self);
1406+ char *line = STR2CSTR(str);
1407+ long n = NUM2LONG(num);
1408+ aco_save_T aco;
1409+
1410+ if (n >= 0 && n <= buf->b_ml.ml_line_count && line != NULL)
1411+ {
1412+ /* set curwin/curbuf for "buf" and save some things */
1413+ aucmd_prepbuf(&aco, buf);
1414
1415- if (n >= 0 && n <= buf->b_ml.ml_line_count && line != NULL) {
1416- curbuf = buf;
1417 if (u_inssub(n + 1) == OK) {
1418 ml_append(n, (char_u *) line, (colnr_T) 0, FALSE);
1419
1420@@ -718,7 +737,11 @@
1421
1422 changed();
1423 }
1424- curbuf = savebuf;
1425+
1426+ /* restore curwin/curbuf and a few other things */
1427+ aucmd_restbuf(&aco);
1428+ /* Careful: autocommands may have made "buf" invalid! */
1429+
1430 update_curbuf(NOT_VALID);
1431 }
1432 else {
1433diff -Naur vim70.orig/src/main.c vim70/src/main.c
1434--- vim70.orig/src/main.c 2006-05-03 10:36:44.000000000 -0700
1435+++ vim70/src/main.c 2006-08-19 16:32:24.000000000 -0700
1436@@ -564,7 +564,11 @@
1437 */
1438 if (p_lpl)
1439 {
1440+# ifdef VMS /* Somehow VMS doesn't handle the "**". */
1441+ source_runtime((char_u *)"plugin/*.vim", TRUE);
1442+# else
1443 source_runtime((char_u *)"plugin/**/*.vim", TRUE);
1444+# endif
1445 TIME_MSG("loading plugins");
1446 }
1447 #endif
1448@@ -3208,10 +3212,15 @@
1449 * Register for remote command execution with :serversend and --remote
1450 * unless there was a -X or a --servername '' on the command line.
1451 * Only register nongui-vim's with an explicit --servername argument.
1452+ * When running as root --servername is also required.
1453 */
1454 if (X_DISPLAY != NULL && parmp->servername != NULL && (
1455 # ifdef FEAT_GUI
1456- gui.in_use ||
1457+ (gui.in_use
1458+# ifdef UNIX
1459+ && getuid() != 0
1460+# endif
1461+ ) ||
1462 # endif
1463 parmp->serverName_arg != NULL))
1464 {
1465diff -Naur vim70.orig/src/Makefile vim70/src/Makefile
1466--- vim70.orig/src/Makefile 2006-05-07 06:25:27.000000000 -0700
1467+++ vim70/src/Makefile 2006-07-14 08:51:21.000000000 -0700
1468@@ -2177,6 +2177,7 @@
1469 cd $(SHADOWDIR)/xxd; ln -s ../../xxd/*.[ch] ../../xxd/Make* .
1470 if test -d $(RSRC_DIR); then \
1471 cd $(SHADOWDIR); \
1472+ ln -s ../infplist.xml .; \
1473 ln -s ../$(RSRC_DIR) ../os_mac.rsr.hqx ../dehqx.py .; \
1474 fi
1475 mkdir $(SHADOWDIR)/testdir
1476diff -Naur vim70.orig/src/mbyte.c vim70/src/mbyte.c
1477--- vim70.orig/src/mbyte.c 2006-04-30 04:51:01.000000000 -0700
1478+++ vim70/src/mbyte.c 2006-08-19 16:34:45.000000000 -0700
1479@@ -311,7 +311,11 @@
1480
1481 #define IDX_MACROMAN 57
1482 {"macroman", ENC_8BIT + ENC_MACROMAN, 0}, /* Mac OS */
1483-#define IDX_COUNT 58
1484+#define IDX_DECMCS 58
1485+ {"dec-mcs", ENC_8BIT, 0}, /* DEC MCS */
1486+#define IDX_HPROMAN8 59
1487+ {"hp-roman8", ENC_8BIT, 0}, /* HP Roman8 */
1488+#define IDX_COUNT 60
1489 };
1490
1491 /*
1492@@ -359,6 +363,8 @@
1493 {"932", IDX_CP932},
1494 {"949", IDX_CP949},
1495 {"936", IDX_CP936},
1496+ {"gbk", IDX_CP936},
1497+ {"gb18030", IDX_CP936}, /* only 99% the same */
1498 {"950", IDX_CP950},
1499 {"eucjp", IDX_EUC_JP},
1500 {"unix-jis", IDX_EUC_JP},
1501@@ -386,6 +392,7 @@
1502 {"950", IDX_BIG5},
1503 #endif
1504 {"mac", IDX_MACROMAN},
1505+ {"mac-roman", IDX_MACROMAN},
1506 {NULL, 0}
1507 };
1508
1509diff -Naur vim70.orig/src/menu.c vim70/src/menu.c
1510--- vim70.orig/src/menu.c 2006-05-03 10:30:48.000000000 -0700
1511+++ vim70/src/menu.c 2006-08-19 16:40:11.000000000 -0700
1512@@ -511,6 +511,14 @@
1513 * name (without mnemonic and accelerator text). */
1514 next_name = menu_name_skip(name);
1515 dname = menu_text(name, NULL, NULL);
1516+ if (dname == NULL)
1517+ goto erret;
1518+ if (*dname == NUL)
1519+ {
1520+ /* Only a mnemonic or accelerator is not valid. */
1521+ EMSG(_("E792: Empty menu name"));
1522+ goto erret;
1523+ }
1524
1525 /* See if it's already there */
1526 lower_pri = menup;
1527@@ -704,6 +712,7 @@
1528 parent = menu;
1529 name = next_name;
1530 vim_free(dname);
1531+ dname = NULL;
1532 if (pri_tab[pri_idx + 1] != -1)
1533 ++pri_idx;
1534 }
1535@@ -793,6 +802,22 @@
1536 erret:
1537 vim_free(path_name);
1538 vim_free(dname);
1539+
1540+ /* Delete any empty submenu we added before discovering the error. Repeat
1541+ * for higher levels. */
1542+ while (parent != NULL && parent->children == NULL)
1543+ {
1544+ if (parent->parent == NULL)
1545+ menup = &root_menu;
1546+ else
1547+ menup = &parent->parent->children;
1548+ for ( ; *menup != NULL && *menup != parent; menup = &((*menup)->next))
1549+ ;
1550+ if (*menup == NULL) /* safety check */
1551+ break;
1552+ parent = parent->parent;
1553+ free_menu(menup);
1554+ }
1555 return FAIL;
1556 }
1557
1558@@ -1753,6 +1778,27 @@
1559 }
1560
1561 /*
1562+ * Check that a pointer appears in the menu tree. Used to protect from using
1563+ * a menu that was deleted after it was selected but before the event was
1564+ * handled.
1565+ * Return OK or FAIL. Used recursively.
1566+ */
1567+ int
1568+check_menu_pointer(root, menu_to_check)
1569+ vimmenu_T *root;
1570+ vimmenu_T *menu_to_check;
1571+{
1572+ vimmenu_T *p;
1573+
1574+ for (p = root; p != NULL; p = p->next)
1575+ if (p == menu_to_check
1576+ || (p->children != NULL
1577+ && check_menu_pointer(p->children, menu_to_check) == OK))
1578+ return OK;
1579+ return FAIL;
1580+}
1581+
1582+/*
1583 * After we have started the GUI, then we can create any menus that have been
1584 * defined. This is done once here. add_menu_path() may have already been
1585 * called to define these menus, and may be called again. This function calls
1586diff -Naur vim70.orig/src/message.c vim70/src/message.c
1587--- vim70.orig/src/message.c 2006-05-06 13:07:37.000000000 -0700
1588+++ vim70/src/message.c 2006-07-14 08:51:21.000000000 -0700
1589@@ -4175,15 +4175,16 @@
1590 str_arg_l = 0;
1591 else
1592 {
1593- /* memchr on HP does not like n > 2^31 !!! */
1594- char *q = memchr(str_arg, '\0',
1595+ /* Don't put the #if inside memchr(), it can be a
1596+ * macro. */
1597 #if SIZEOF_INT <= 2
1598- precision
1599+ char *q = memchr(str_arg, '\0', precision);
1600 #else
1601- precision <= (size_t)0x7fffffffL ? precision
1602- : (size_t)0x7fffffffL
1603+ /* memchr on HP does not like n > 2^31 !!! */
1604+ char *q = memchr(str_arg, '\0',
1605+ precision <= (size_t)0x7fffffffL ? precision
1606+ : (size_t)0x7fffffffL);
1607 #endif
1608- );
1609 str_arg_l = (q == NULL) ? precision : q - str_arg;
1610 }
1611 break;
1612diff -Naur vim70.orig/src/misc1.c vim70/src/misc1.c
1613--- vim70.orig/src/misc1.c 2006-04-30 08:30:02.000000000 -0700
1614+++ vim70/src/misc1.c 2006-08-19 16:32:45.000000000 -0700
1615@@ -4492,7 +4492,7 @@
1616 int l = mb_ptr2len(s);
1617
1618 while (--l > 0)
1619- *d++ = *s++;
1620+ *d++ = *++s;
1621 }
1622 # endif
1623 }
1624diff -Naur vim70.orig/src/netbeans.c vim70/src/netbeans.c
1625--- vim70.orig/src/netbeans.c 2006-04-22 11:00:05.000000000 -0700
1626+++ vim70/src/netbeans.c 2006-08-09 08:38:32.000000000 -0700
1627@@ -1986,6 +1986,8 @@
1628 if (buf->bufp != NULL)
1629 do_buffer(DOBUF_WIPE, DOBUF_FIRST, FORWARD,
1630 buf->bufp->b_fnum, TRUE);
1631+ buf->bufp = NULL;
1632+ buf->initDone = FALSE;
1633 doupdate = 1;
1634 /* =====================================================================*/
1635 }
1636diff -Naur vim70.orig/src/normal.c vim70/src/normal.c
1637--- vim70.orig/src/normal.c 2006-04-29 06:11:18.000000000 -0700
1638+++ vim70/src/normal.c 2006-08-19 16:40:11.000000000 -0700
1639@@ -2504,7 +2504,8 @@
1640 * NOTE: Ignore right button down and drag mouse events.
1641 * Windows only shows the popup menu on the button up event.
1642 */
1643-#if defined(FEAT_GUI_MOTIF) || defined(FEAT_GUI_GTK) || defined(FEAT_GUI_PHOTON)
1644+#if defined(FEAT_GUI_MOTIF) || defined(FEAT_GUI_GTK) \
1645+ || defined(FEAT_GUI_PHOTON) || defined(FEAT_GUI_MAC)
1646 if (!is_click)
1647 return FALSE;
1648 #endif
1649diff -Naur vim70.orig/src/ops.c vim70/src/ops.c
1650--- vim70.orig/src/ops.c 2006-04-30 08:13:44.000000000 -0700
1651+++ vim70/src/ops.c 2006-08-09 08:33:53.000000000 -0700
1652@@ -2413,6 +2413,7 @@
1653 else
1654 {
1655 curwin->w_cursor = oap->end;
1656+ check_cursor_col();
1657
1658 /* Works just like an 'i'nsert on the next character. */
1659 if (!lineempty(curwin->w_cursor.lnum)
1660@@ -3492,8 +3493,15 @@
1661 # endif
1662 if (flags & PUT_CURSEND)
1663 {
1664+ colnr_T len;
1665+
1666 curwin->w_cursor = curbuf->b_op_end;
1667 curwin->w_cursor.col++;
1668+
1669+ /* in Insert mode we might be after the NUL, correct for that */
1670+ len = (colnr_T)STRLEN(ml_get_curline());
1671+ if (curwin->w_cursor.col > len)
1672+ curwin->w_cursor.col = len;
1673 }
1674 else
1675 curwin->w_cursor.lnum = lnum;
1676diff -Naur vim70.orig/src/option.c vim70/src/option.c
1677--- vim70.orig/src/option.c 2006-05-03 10:32:28.000000000 -0700
1678+++ vim70/src/option.c 2006-08-09 08:34:17.000000000 -0700
1679@@ -2294,7 +2294,7 @@
1680 {(char_u *)0L, (char_u *)0L}
1681 #endif
1682 },
1683- {"spellsuggest", "sps", P_STRING|P_VI_DEF|P_EXPAND|P_SECURE,
1684+ {"spellsuggest", "sps", P_STRING|P_VI_DEF|P_EXPAND|P_SECURE|P_COMMA,
1685 #ifdef FEAT_SPELL
1686 (char_u *)&p_sps, PV_NONE,
1687 {(char_u *)"best", (char_u *)0L}
1688@@ -5227,13 +5227,13 @@
1689 case PV_STL: return &curwin->w_p_stl_flags;
1690 #endif
1691 #ifdef FEAT_EVAL
1692+# ifdef FEAT_FOLDING
1693 case PV_FDE: return &curwin->w_p_fde_flags;
1694 case PV_FDT: return &curwin->w_p_fdt_flags;
1695+# endif
1696 # ifdef FEAT_BEVAL
1697 case PV_BEXPR: return &curbuf->b_p_bexpr_flags;
1698 # endif
1699-#endif
1700-#if defined(FEAT_EVAL)
1701 # if defined(FEAT_CINDENT)
1702 case PV_INDE: return &curbuf->b_p_inde_flags;
1703 # endif
1704@@ -6325,7 +6325,8 @@
1705 else
1706 errmsg = check_stl_option(p_ruf);
1707 }
1708- else
1709+ /* check 'statusline' only if it doesn't start with "%!" */
1710+ else if (varp != &p_stl || s[0] != '%' || s[1] != '!')
1711 errmsg = check_stl_option(s);
1712 if (varp == &p_ruf && errmsg == NULL)
1713 comp_col();
1714diff -Naur vim70.orig/src/os_unix.c vim70/src/os_unix.c
1715--- vim70.orig/src/os_unix.c 2006-05-01 01:13:15.000000000 -0700
1716+++ vim70/src/os_unix.c 2006-07-14 08:51:21.000000000 -0700
1717@@ -4971,7 +4971,8 @@
1718 if (((*file)[*num_file] = alloc(len + 2)) != NULL)
1719 {
1720 STRCPY((*file)[*num_file], p);
1721- if (!after_pathsep((*file)[*num_file] + len))
1722+ if (!after_pathsep((*file)[*num_file],
1723+ (*file)[*num_file] + len))
1724 {
1725 (*file)[*num_file][len] = psepc;
1726 (*file)[*num_file][len + 1] = NUL;
1727@@ -5757,8 +5758,13 @@
1728 int retval_int = 0;
1729 int success = FALSE;
1730
1731- /* Get a handle to the DLL module. */
1732+ /*
1733+ * Get a handle to the DLL module.
1734+ */
1735 # if defined(USE_DLOPEN)
1736+ /* First clear any error, it's not cleared by the dlopen() call. */
1737+ (void)dlerror();
1738+
1739 hinstLib = dlopen((char *)libname, RTLD_LAZY
1740 # ifdef RTLD_LOCAL
1741 | RTLD_LOCAL
1742diff -Naur vim70.orig/src/popupmnu.c vim70/src/popupmnu.c
1743--- vim70.orig/src/popupmnu.c 2006-04-20 13:18:37.000000000 -0700
1744+++ vim70/src/popupmnu.c 2006-08-27 12:48:28.000000000 -0700
1745@@ -552,6 +552,9 @@
1746 {
1747 pum_array = NULL;
1748 redraw_all_later(SOME_VALID);
1749+#ifdef FEAT_WINDOWS
1750+ redraw_tabline = TRUE;
1751+#endif
1752 status_redraw_all();
1753 }
1754
1755diff -Naur vim70.orig/src/proto/menu.pro vim70/src/proto/menu.pro
1756--- vim70.orig/src/proto/menu.pro 2006-05-07 06:08:51.000000000 -0700
1757+++ vim70/src/proto/menu.pro 2006-08-19 16:40:11.000000000 -0700
1758@@ -10,6 +10,7 @@
1759 extern int menu_is_child_of_popup __ARGS((vimmenu_T *menu));
1760 extern int menu_is_toolbar __ARGS((char_u *name));
1761 extern int menu_is_separator __ARGS((char_u *name));
1762+extern int check_menu_pointer __ARGS((vimmenu_T *root, vimmenu_T *menu_to_check));
1763 extern void gui_create_initial_menus __ARGS((vimmenu_T *menu));
1764 extern void gui_update_menus __ARGS((int modes));
1765 extern int gui_is_menu_shortcut __ARGS((int key));
1766diff -Naur vim70.orig/src/proto/undo.pro vim70/src/proto/undo.pro
1767--- vim70.orig/src/proto/undo.pro 2006-05-07 06:09:11.000000000 -0700
1768+++ vim70/src/proto/undo.pro 2006-07-14 10:51:11.000000000 -0700
1769@@ -4,6 +4,7 @@
1770 extern int u_savesub __ARGS((linenr_T lnum));
1771 extern int u_inssub __ARGS((linenr_T lnum));
1772 extern int u_savedel __ARGS((linenr_T lnum, long nlines));
1773+extern int undo_allowed __ARGS((void));
1774 extern void u_undo __ARGS((int count));
1775 extern void u_redo __ARGS((int count));
1776 extern void undo_time __ARGS((long step, int sec, int absolute));
1777diff -Naur vim70.orig/src/quickfix.c vim70/src/quickfix.c
1778--- vim70.orig/src/quickfix.c 2006-05-03 00:47:42.000000000 -0700
1779+++ vim70/src/quickfix.c 2006-08-19 16:39:02.000000000 -0700
1780@@ -602,13 +602,19 @@
1781 else
1782 type = 0;
1783 /*
1784- * Extract error message data from matched line
1785+ * Extract error message data from matched line.
1786+ * We check for an actual submatch, because "\[" and "\]" in
1787+ * the 'errorformat' may cause the wrong submatch to be used.
1788 */
1789 if ((i = (int)fmt_ptr->addr[0]) > 0) /* %f */
1790 {
1791- int c = *regmatch.endp[i];
1792+ int c;
1793+
1794+ if (regmatch.startp[i] == NULL || regmatch.endp[i] == NULL)
1795+ continue;
1796
1797 /* Expand ~/file and $HOME/file to full path. */
1798+ c = *regmatch.endp[i];
1799 *regmatch.endp[i] = NUL;
1800 expand_env(regmatch.startp[i], namebuf, CMDBUFFSIZE);
1801 *regmatch.endp[i] = c;
1802@@ -618,35 +624,63 @@
1803 continue;
1804 }
1805 if ((i = (int)fmt_ptr->addr[1]) > 0) /* %n */
1806+ {
1807+ if (regmatch.startp[i] == NULL)
1808+ continue;
1809 enr = (int)atol((char *)regmatch.startp[i]);
1810+ }
1811 if ((i = (int)fmt_ptr->addr[2]) > 0) /* %l */
1812+ {
1813+ if (regmatch.startp[i] == NULL)
1814+ continue;
1815 lnum = atol((char *)regmatch.startp[i]);
1816+ }
1817 if ((i = (int)fmt_ptr->addr[3]) > 0) /* %c */
1818+ {
1819+ if (regmatch.startp[i] == NULL)
1820+ continue;
1821 col = (int)atol((char *)regmatch.startp[i]);
1822+ }
1823 if ((i = (int)fmt_ptr->addr[4]) > 0) /* %t */
1824+ {
1825+ if (regmatch.startp[i] == NULL)
1826+ continue;
1827 type = *regmatch.startp[i];
1828+ }
1829 if (fmt_ptr->flags == '+' && !multiscan) /* %+ */
1830 STRCPY(errmsg, IObuff);
1831 else if ((i = (int)fmt_ptr->addr[5]) > 0) /* %m */
1832 {
1833+ if (regmatch.startp[i] == NULL || regmatch.endp[i] == NULL)
1834+ continue;
1835 len = (int)(regmatch.endp[i] - regmatch.startp[i]);
1836 vim_strncpy(errmsg, regmatch.startp[i], len);
1837 }
1838 if ((i = (int)fmt_ptr->addr[6]) > 0) /* %r */
1839+ {
1840+ if (regmatch.startp[i] == NULL)
1841+ continue;
1842 tail = regmatch.startp[i];
1843+ }
1844 if ((i = (int)fmt_ptr->addr[7]) > 0) /* %p */
1845 {
1846+ if (regmatch.startp[i] == NULL || regmatch.endp[i] == NULL)
1847+ continue;
1848 col = (int)(regmatch.endp[i] - regmatch.startp[i] + 1);
1849 if (*((char_u *)regmatch.startp[i]) != TAB)
1850 use_viscol = TRUE;
1851 }
1852 if ((i = (int)fmt_ptr->addr[8]) > 0) /* %v */
1853 {
1854+ if (regmatch.startp[i] == NULL)
1855+ continue;
1856 col = (int)atol((char *)regmatch.startp[i]);
1857 use_viscol = TRUE;
1858 }
1859 if ((i = (int)fmt_ptr->addr[9]) > 0) /* %s */
1860 {
1861+ if (regmatch.startp[i] == NULL || regmatch.endp[i] == NULL)
1862+ continue;
1863 len = (int)(regmatch.endp[i] - regmatch.startp[i]);
1864 if (len > CMDBUFFSIZE - 5)
1865 len = CMDBUFFSIZE - 5;
1866@@ -2429,32 +2463,19 @@
1867 qf_info_T *qi;
1868 {
1869 buf_T *buf;
1870-#ifdef FEAT_AUTOCMD
1871 aco_save_T aco;
1872-#else
1873- buf_T *save_curbuf;
1874-#endif
1875
1876 /* Check if a buffer for the quickfix list exists. Update it. */
1877 buf = qf_find_buf(qi);
1878 if (buf != NULL)
1879 {
1880-#ifdef FEAT_AUTOCMD
1881 /* set curwin/curbuf to buf and save a few things */
1882 aucmd_prepbuf(&aco, buf);
1883-#else
1884- save_curbuf = curbuf;
1885- curbuf = buf;
1886-#endif
1887
1888 qf_fill_buffer(qi);
1889
1890-#ifdef FEAT_AUTOCMD
1891 /* restore curwin/curbuf and a few other things */
1892 aucmd_restbuf(&aco);
1893-#else
1894- curbuf = save_curbuf;
1895-#endif
1896
1897 (void)qf_win_pos_update(qi, 0);
1898 }
1899@@ -2943,10 +2964,8 @@
1900 #if defined(FEAT_AUTOCMD) && defined(FEAT_SYN_HL)
1901 char_u *save_ei = NULL;
1902 #endif
1903-#ifndef FEAT_AUTOCMD
1904- buf_T *save_curbuf;
1905-#else
1906 aco_save_T aco;
1907+#ifdef FEAT_AUTOCMD
1908 char_u *au_name = NULL;
1909 int flags = 0;
1910 colnr_T col;
1911@@ -3167,24 +3186,13 @@
1912 * need to be done now, in that buffer. And the modelines
1913 * need to be done (again). But not the window-local
1914 * options! */
1915-#if defined(FEAT_AUTOCMD)
1916 aucmd_prepbuf(&aco, buf);
1917-#else
1918- save_curbuf = curbuf;
1919- curbuf = buf;
1920- curwin->w_buffer = curbuf;
1921-#endif
1922 #if defined(FEAT_AUTOCMD) && defined(FEAT_SYN_HL)
1923 apply_autocmds(EVENT_FILETYPE, buf->b_p_ft,
1924 buf->b_fname, TRUE, buf);
1925 #endif
1926 do_modelines(OPT_NOWIN);
1927-#if defined(FEAT_AUTOCMD)
1928 aucmd_restbuf(&aco);
1929-#else
1930- curbuf = save_curbuf;
1931- curwin->w_buffer = curbuf;
1932-#endif
1933 }
1934 }
1935 }
1936@@ -3285,11 +3293,7 @@
1937 {
1938 buf_T *newbuf;
1939 int failed = TRUE;
1940-#ifdef FEAT_AUTOCMD
1941 aco_save_T aco;
1942-#else
1943- buf_T *old_curbuf = curbuf;
1944-#endif
1945
1946 /* Allocate a buffer without putting it in the buffer list. */
1947 newbuf = buflist_new(NULL, NULL, (linenr_T)1, BLN_DUMMY);
1948@@ -3299,13 +3303,8 @@
1949 /* Init the options. */
1950 buf_copy_options(newbuf, BCO_ENTER | BCO_NOHELP);
1951
1952-#ifdef FEAT_AUTOCMD
1953 /* set curwin/curbuf to buf and save a few things */
1954 aucmd_prepbuf(&aco, newbuf);
1955-#else
1956- curbuf = newbuf;
1957- curwin->w_buffer = newbuf;
1958-#endif
1959
1960 /* Need to set the filename for autocommands. */
1961 (void)setfname(curbuf, fname, NULL, FALSE);
1962@@ -3336,13 +3335,8 @@
1963 }
1964 }
1965
1966-#ifdef FEAT_AUTOCMD
1967 /* restore curwin/curbuf and a few other things */
1968 aucmd_restbuf(&aco);
1969-#else
1970- curbuf = old_curbuf;
1971- curwin->w_buffer = old_curbuf;
1972-#endif
1973
1974 if (!buf_valid(newbuf))
1975 return NULL;
1976diff -Naur vim70.orig/src/screen.c vim70/src/screen.c
1977--- vim70.orig/src/screen.c 2006-05-05 03:13:55.000000000 -0700
1978+++ vim70/src/screen.c 2006-07-14 10:50:30.000000000 -0700
1979@@ -2612,7 +2612,8 @@
1980 #ifdef FEAT_LINEBREAK
1981 int need_showbreak = FALSE;
1982 #endif
1983-#if defined(FEAT_SIGNS) || (defined(FEAT_QUICKFIX) && defined(FEAT_WINDOWS))
1984+#if defined(FEAT_SIGNS) || (defined(FEAT_QUICKFIX) && defined(FEAT_WINDOWS)) \
1985+ || defined(FEAT_SYN_HL) || defined(FEAT_DIFF)
1986 # define LINE_ATTR
1987 int line_attr = 0; /* atrribute for the whole line */
1988 #endif
1989@@ -2626,7 +2627,7 @@
1990 int prev_c = 0; /* previous Arabic character */
1991 int prev_c1 = 0; /* first composing char for prev_c */
1992 #endif
1993-#if defined(FEAT_DIFF) || defined(LINE_ATTR)
1994+#if defined(LINE_ATTR)
1995 int did_line_attr = 0;
1996 #endif
1997
1998@@ -4116,17 +4117,12 @@
1999 --ptr; /* put it back at the NUL */
2000 }
2001 #endif
2002-#if defined(FEAT_DIFF) || defined(LINE_ATTR)
2003+#if defined(LINE_ATTR)
2004 else if ((
2005 # ifdef FEAT_DIFF
2006- diff_hlf != (hlf_T)0
2007-# ifdef LINE_ATTR
2008- ||
2009-# endif
2010+ diff_hlf != (hlf_T)0 ||
2011 # endif
2012-# ifdef LINE_ATTR
2013 line_attr != 0
2014-# endif
2015 ) && (
2016 # ifdef FEAT_RIGHTLEFT
2017 wp->w_p_rl ? (col >= 0) :
2018@@ -4237,7 +4233,7 @@
2019 * At end of the text line or just after the last character.
2020 */
2021 if (c == NUL
2022-#if defined(FEAT_DIFF) || defined(LINE_ATTR)
2023+#if defined(LINE_ATTR)
2024 || did_line_attr == 1
2025 #endif
2026 )
2027@@ -4258,7 +4254,7 @@
2028 || prevcol == (long)match_hl[0].startcol
2029 || prevcol == (long)match_hl[1].startcol
2030 || prevcol == (long)match_hl[2].startcol)
2031-# if defined(FEAT_DIFF) || defined(LINE_ATTR)
2032+# if defined(LINE_ATTR)
2033 && did_line_attr <= 1
2034 # endif
2035 )
2036@@ -7133,6 +7129,12 @@
2037 return;
2038 entered = TRUE;
2039
2040+ /*
2041+ * Note that the window sizes are updated before reallocating the arrays,
2042+ * thus we must not redraw here!
2043+ */
2044+ ++RedrawingDisabled;
2045+
2046 win_new_shellsize(); /* fit the windows in the new sized shell */
2047
2048 comp_col(); /* recompute columns for shown command and ruler */
2049@@ -7367,6 +7369,7 @@
2050 #endif
2051
2052 entered = FALSE;
2053+ --RedrawingDisabled;
2054
2055 #ifdef FEAT_AUTOCMD
2056 if (starting == 0)
2057diff -Naur vim70.orig/src/spell.c vim70/src/spell.c
2058--- vim70.orig/src/spell.c 2006-05-05 00:49:58.000000000 -0700
2059+++ vim70/src/spell.c 2006-08-09 08:31:46.000000000 -0700
2060@@ -2108,7 +2108,8 @@
2061 * possible. */
2062 STRCPY(buf, line);
2063 if (lnum < wp->w_buffer->b_ml.ml_line_count)
2064- spell_cat_line(buf + STRLEN(buf), ml_get(lnum + 1), MAXWLEN);
2065+ spell_cat_line(buf + STRLEN(buf),
2066+ ml_get_buf(wp->w_buffer, lnum + 1, FALSE), MAXWLEN);
2067
2068 p = buf + skip;
2069 endp = buf + len;
2070@@ -10070,6 +10071,7 @@
2071
2072 /* List the suggestions. */
2073 msg_start();
2074+ msg_row = Rows - 1; /* for when 'cmdheight' > 1 */
2075 lines_left = Rows; /* avoid more prompt */
2076 vim_snprintf((char *)IObuff, IOSIZE, _("Change \"%.*s\" to:"),
2077 sug.su_badlen, sug.su_badptr);
2078diff -Naur vim70.orig/src/structs.h vim70/src/structs.h
2079--- vim70.orig/src/structs.h 2006-04-09 10:57:46.000000000 -0700
2080+++ vim70/src/structs.h 2006-08-19 16:39:02.000000000 -0700
2081@@ -2213,18 +2213,20 @@
2082
2083 /*
2084 * Struct to save values in before executing autocommands for a buffer that is
2085- * not the current buffer.
2086+ * not the current buffer. Without FEAT_AUTOCMD only "curbuf" is remembered.
2087 */
2088 typedef struct
2089 {
2090 buf_T *save_buf; /* saved curbuf */
2091+#ifdef FEAT_AUTOCMD
2092 buf_T *new_curbuf; /* buffer to be used */
2093 win_T *save_curwin; /* saved curwin, NULL if it didn't change */
2094 win_T *new_curwin; /* new curwin if save_curwin != NULL */
2095 pos_T save_cursor; /* saved cursor pos of save_curwin */
2096 linenr_T save_topline; /* saved topline of save_curwin */
2097-#ifdef FEAT_DIFF
2098+# ifdef FEAT_DIFF
2099 int save_topfill; /* saved topfill of save_curwin */
2100+# endif
2101 #endif
2102 } aco_save_T;
2103
2104diff -Naur vim70.orig/src/term.c vim70/src/term.c
2105--- vim70.orig/src/term.c 2006-05-03 10:34:57.000000000 -0700
2106+++ vim70/src/term.c 2006-08-19 16:40:11.000000000 -0700
2107@@ -4783,6 +4783,14 @@
2108 return -1;
2109 current_menu = (vimmenu_T *)val;
2110 slen += num_bytes;
2111+
2112+ /* The menu may have been deleted right after it was used, check
2113+ * for that. */
2114+ if (check_menu_pointer(root_menu, current_menu) == FAIL)
2115+ {
2116+ key_name[0] = KS_EXTRA;
2117+ key_name[1] = (int)KE_IGNORE;
2118+ }
2119 }
2120 # endif
2121 # ifdef FEAT_GUI_TABLINE
2122diff -Naur vim70.orig/src/undo.c vim70/src/undo.c
2123--- vim70.orig/src/undo.c 2006-04-21 02:30:59.000000000 -0700
2124+++ vim70/src/undo.c 2006-07-14 10:51:11.000000000 -0700
2125@@ -84,7 +84,6 @@
2126 static void u_unch_branch __ARGS((u_header_T *uhp));
2127 static u_entry_T *u_get_headentry __ARGS((void));
2128 static void u_getbot __ARGS((void));
2129-static int undo_allowed __ARGS((void));
2130 static int u_savecommon __ARGS((linenr_T, linenr_T, linenr_T));
2131 static void u_doit __ARGS((int count));
2132 static void u_undoredo __ARGS((int undo));
2133@@ -196,7 +195,7 @@
2134 * Return TRUE when undo is allowed. Otherwise give an error message and
2135 * return FALSE.
2136 */
2137- static int
2138+ int
2139 undo_allowed()
2140 {
2141 /* Don't allow changes when 'modifiable' is off. */
2142diff -Naur vim70.orig/src/version.c vim70/src/version.c
2143--- vim70.orig/src/version.c 2006-05-03 00:50:42.000000000 -0700
2144+++ vim70/src/version.c 2006-08-27 12:48:28.000000000 -0700
2145@@ -667,6 +667,126 @@
2146 static int included_patches[] =
2147 { /* Add new patch number below this line */
2148 /**/
2149+ 66,
2150+/**/
2151+ 64,
2152+/**/
2153+ 63,
2154+/**/
2155+ 62,
2156+/**/
2157+ 61,
2158+/**/
2159+ 60,
2160+/**/
2161+ 59,
2162+/**/
2163+ 58,
2164+/**/
2165+ 56,
2166+/**/
2167+ 55,
2168+/**/
2169+ 54,
2170+/**/
2171+ 53,
2172+/**/
2173+ 52,
2174+/**/
2175+ 51,
2176+/**/
2177+ 50,
2178+/**/
2179+ 49,
2180+/**/
2181+ 48,
2182+/**/
2183+ 47,
2184+/**/
2185+ 46,
2186+/**/
2187+ 44,
2188+/**/
2189+ 43,
2190+/**/
2191+ 42,
2192+/**/
2193+ 41,
2194+/**/
2195+ 40,
2196+/**/
2197+ 39,
2198+/**/
2199+ 38,
2200+/**/
2201+ 37,
2202+/**/
2203+ 36,
2204+/**/
2205+ 35,
2206+/**/
2207+ 34,
2208+/**/
2209+ 33,
2210+/**/
2211+ 31,
2212+/**/
2213+ 30,
2214+/**/
2215+ 29,
2216+/**/
2217+ 28,
2218+/**/
2219+ 26,
2220+/**/
2221+ 25,
2222+/**/
2223+ 24,
2224+/**/
2225+ 23,
2226+/**/
2227+ 22,
2228+/**/
2229+ 21,
2230+/**/
2231+ 20,
2232+/**/
2233+ 19,
2234+/**/
2235+ 18,
2236+/**/
2237+ 17,
2238+/**/
2239+ 16,
2240+/**/
2241+ 15,
2242+/**/
2243+ 14,
2244+/**/
2245+ 13,
2246+/**/
2247+ 12,
2248+/**/
2249+ 11,
2250+/**/
2251+ 10,
2252+/**/
2253+ 9,
2254+/**/
2255+ 8,
2256+/**/
2257+ 7,
2258+/**/
2259+ 6,
2260+/**/
2261+ 4,
2262+/**/
2263+ 3,
2264+/**/
2265+ 2,
2266+/**/
2267+ 1,
2268+/**/
2269 0
2270 };
2271
2272diff -Naur vim70.orig/src/vim.h vim70/src/vim.h
2273--- vim70.orig/src/vim.h 2006-04-30 08:32:38.000000000 -0700
2274+++ vim70/src/vim.h 2006-07-14 08:51:21.000000000 -0700
2275@@ -585,7 +585,6 @@
2276 #define INSERT 0x10 /* Insert mode */
2277 #define LANGMAP 0x20 /* Language mapping, can be combined with
2278 INSERT and CMDLINE */
2279-#define MAP_ALL_MODES 0x3f /* all mode bits used for mapping */
2280
2281 #define REPLACE_FLAG 0x40 /* Replace mode flag */
2282 #define REPLACE (REPLACE_FLAG + INSERT)
2283@@ -605,6 +604,9 @@
2284 #define CONFIRM 0x800 /* ":confirm" prompt */
2285 #define SELECTMODE 0x1000 /* Select mode, only for mappings */
2286
2287+#define MAP_ALL_MODES (0x3f | SELECTMODE) /* all mode bits used for
2288+ * mapping */
2289+
2290 /* directions */
2291 #define FORWARD 1
2292 #define BACKWARD (-1)
2293@@ -1983,7 +1985,7 @@
2294 /* values for vim_handle_signal() that are not a signal */
2295 #define SIGNAL_BLOCK -1
2296 #define SIGNAL_UNBLOCK -2
2297-#if !defined(UNIX) && !defined(VMS)
2298+#if !defined(UNIX) && !defined(VMS) && !defined(OS2)
2299 # define vim_handle_signal(x) 0
2300 #endif
2301
2302
Note: See TracBrowser for help on using the repository browser.