source: patches/vim-7.1-fixes-2.patch@ fd5c672

clfs-1.2 clfs-2.1 clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since fd5c672 was 24cc73c, checked in by Joe Ciccone <jciccone@…>, 17 years ago

Updated the bash fixes patch and the vim fixes patch.

  • Property mode set to 100644
File size: 34.5 KB
RevLine 
[24cc73c]1Submitted By: Jim Gifford (jim at linuxfromscratch dot org)
2Date: 07-23-2007
3Initial Package Version: 7.1
4Origin: Upstream
5Upstream Status: Applied
6Description: Contains all upstream patches up to 7.1.033
7 The following patches were skipped
8 0 003 007
9
10diff -Naur vim71.orig/runtime/doc/change.txt vim71/runtime/doc/change.txt
11--- vim71.orig/runtime/doc/change.txt 2007-05-12 06:18:46.000000000 -0400
12+++ vim71/runtime/doc/change.txt 2007-07-23 19:57:09.000000000 -0400
13@@ -1571,6 +1571,10 @@
14 in their original order, right before the sorted
15 lines.
16
17+ If {pattern} is empty (e.g. // is specified), the
18+ last search pattern is used. This allows trying out
19+ a pattern first.
20+
21 Note that using ":sort" with ":global" doesn't sort the matching lines, it's
22 quite useless.
23
24diff -Naur vim71.orig/runtime/doc/eval.txt vim71/runtime/doc/eval.txt
25--- vim71.orig/runtime/doc/eval.txt 2007-05-12 06:18:46.000000000 -0400
26+++ vim71/runtime/doc/eval.txt 2007-07-23 19:57:09.000000000 -0400
27@@ -1,4 +1,4 @@
28-*eval.txt* For Vim version 7.1. Last change: 2007 May 11
29+*eval.txt* For Vim version 7.1. Last change: 2007 Jul 11
30
31
32 VIM REFERENCE MANUAL by Bram Moolenaar
33@@ -2020,6 +2020,10 @@
34 number of characters in the cursor line plus one)
35 'x position of mark x (if the mark is not set, 0 is
36 returned)
37+ Additionally {expr} can be [lnum, col]: a |List| with the line
38+ and column number. Most useful when the column is "$", to get
39+ the las column of a specific line. When "lnum" or "col" is
40+ out of range then col() returns zero.
41 To get the line number use |line()|. To get both use
42 |getpos()|.
43 For the screen column position use |virtcol()|.
44@@ -2824,6 +2828,8 @@
45 given file {fname}.
46 If {fname} is a directory, 0 is returned.
47 If the file {fname} can't be found, -1 is returned.
48+ If the size of {fname} is too big to fit in a Number then -2
49+ is returned.
50
51 getfontname([{name}]) *getfontname()*
52 Without an argument returns the name of the normal font being
53@@ -5022,14 +5028,12 @@
54 position, the returned Number will be the column at the end of
55 the <Tab>. For example, for a <Tab> in column 1, with 'ts'
56 set to 8, it returns 8.
57- For the use of {expr} see |col()|. Additionally you can use
58- [lnum, col]: a |List| with the line and column number. When
59- "lnum" or "col" is out of range then virtcol() returns zero.
60- When 'virtualedit' is used it can be [lnum, col, off], where
61+ For the byte position use |col()|.
62+ For the use of {expr} see |col()|.
63+ When 'virtualedit' is used {expr} can be [lnum, col, off], where
64 "off" is the offset in screen columns from the start of the
65 character. E.g., a position within a <Tab> or after the last
66 character.
67- For the byte position use |col()|.
68 When Virtual editing is active in the current mode, a position
69 beyond the end of the line can be returned. |'virtualedit'|
70 The accepted positions are:
71diff -Naur vim71.orig/runtime/filetype.vim vim71/runtime/filetype.vim
72--- vim71.orig/runtime/filetype.vim 2007-05-10 11:14:37.000000000 -0400
73+++ vim71/runtime/filetype.vim 2007-07-23 19:57:05.000000000 -0400
74@@ -1,7 +1,7 @@
75 " Vim support file to detect file types
76 "
77 " Maintainer: Bram Moolenaar <Bram@vim.org>
78-" Last Change: 2007 May 10
79+" Last Change: 2007 May 15
80
81 " Listen very carefully, I will say this only once
82 if exists("did_load_filetypes")
83@@ -1286,7 +1286,7 @@
84 au BufNewFile,BufRead *.it,*.ih setf ppwiz
85
86 " Oracle Pro*C/C++
87-au BufNewFile,BufRead .pc setf proc
88+au BufNewFile,BufRead *.pc setf proc
89
90 " Privoxy actions file
91 au BufNewFile,BufRead *.action setf privoxy
92diff -Naur vim71.orig/src/auto/configure vim71/src/auto/configure
93--- vim71.orig/src/auto/configure 2007-05-12 07:49:09.000000000 -0400
94+++ vim71/src/auto/configure 2007-07-23 19:57:08.000000000 -0400
95@@ -3843,7 +3843,9 @@
96 fi
97
98 if test "X$vi_cv_path_mzscheme_pfx" != "X"; then
99- if test -f "${vi_cv_path_mzscheme_pfx}/lib/libmzgc.a"; then
100+ if test "x$MACOSX" = "xyes"; then
101+ MZSCHEME_LIBS="-framework PLT_MzScheme"
102+ elif test -f "${vi_cv_path_mzscheme_pfx}/lib/libmzgc.a"; then
103 MZSCHEME_LIBS="${vi_cv_path_mzscheme_pfx}/lib/libmzscheme.a ${vi_cv_path_mzscheme_pfx}/lib/libmzgc.a"
104 else
105 MZSCHEME_LIBS="-L${vi_cv_path_mzscheme_pfx}/lib -lmzscheme -lmzgc"
106diff -Naur vim71.orig/src/buffer.c vim71/src/buffer.c
107--- vim71.orig/src/buffer.c 2007-05-10 11:25:59.000000000 -0400
108+++ vim71/src/buffer.c 2007-07-23 19:57:07.000000000 -0400
109@@ -171,6 +171,13 @@
110 /* Put the cursor on the first line. */
111 curwin->w_cursor.lnum = 1;
112 curwin->w_cursor.col = 0;
113+
114+ /* Set or reset 'modified' before executing autocommands, so that
115+ * it can be changed there. */
116+ if (!readonlymode && !bufempty())
117+ changed();
118+ else if (retval != FAIL)
119+ unchanged(curbuf, FALSE);
120 #ifdef FEAT_AUTOCMD
121 # ifdef FEAT_EVAL
122 apply_autocmds_retval(EVENT_STDINREADPOST, NULL, NULL, FALSE,
123@@ -194,16 +201,16 @@
124 /* When reading stdin, the buffer contents always needs writing, so set
125 * the changed flag. Unless in readonly mode: "ls | gview -".
126 * When interrupted and 'cpoptions' contains 'i' set changed flag. */
127- if ((read_stdin && !readonlymode && !bufempty())
128+ if ((got_int && vim_strchr(p_cpo, CPO_INTMOD) != NULL)
129 #ifdef FEAT_AUTOCMD
130 || modified_was_set /* ":set modified" used in autocmd */
131 # ifdef FEAT_EVAL
132 || (aborting() && vim_strchr(p_cpo, CPO_INTMOD) != NULL)
133 # endif
134 #endif
135- || (got_int && vim_strchr(p_cpo, CPO_INTMOD) != NULL))
136+ )
137 changed();
138- else if (retval != FAIL)
139+ else if (retval != FAIL && !read_stdin)
140 unchanged(curbuf, FALSE);
141 save_file_ff(curbuf); /* keep this fileformat */
142
143diff -Naur vim71.orig/src/configure.in vim71/src/configure.in
144--- vim71.orig/src/configure.in 2007-05-12 05:19:27.000000000 -0400
145+++ vim71/src/configure.in 2007-07-23 19:57:08.000000000 -0400
146@@ -423,7 +423,9 @@
147 fi
148
149 if test "X$vi_cv_path_mzscheme_pfx" != "X"; then
150- if test -f "${vi_cv_path_mzscheme_pfx}/lib/libmzgc.a"; then
151+ if test "x$MACOSX" = "xyes"; then
152+ MZSCHEME_LIBS="-framework PLT_MzScheme"
153+ elif test -f "${vi_cv_path_mzscheme_pfx}/lib/libmzgc.a"; then
154 MZSCHEME_LIBS="${vi_cv_path_mzscheme_pfx}/lib/libmzscheme.a ${vi_cv_path_mzscheme_pfx}/lib/libmzgc.a"
155 else
156 MZSCHEME_LIBS="-L${vi_cv_path_mzscheme_pfx}/lib -lmzscheme -lmzgc"
157diff -Naur vim71.orig/src/digraph.c vim71/src/digraph.c
158--- vim71.orig/src/digraph.c 2006-05-02 14:24:04.000000000 -0400
159+++ vim71/src/digraph.c 2007-07-23 19:57:09.000000000 -0400
160@@ -2349,8 +2349,10 @@
161
162 if (*curbuf->b_p_keymap == NUL)
163 {
164- /* Stop any active keymap and clear the table. */
165+ /* Stop any active keymap and clear the table. Also remove
166+ * b:keymap_unload, as no keymap is active now. */
167 keymap_unload();
168+ do_cmdline_cmd((char_u *)"unlet! b:keymap_name");
169 }
170 else
171 {
172@@ -2500,7 +2502,6 @@
173
174 ga_clear(&curbuf->b_kmap_ga);
175 curbuf->b_kmap_state &= ~KEYMAP_LOADED;
176- do_cmdline_cmd((char_u *)"unlet! b:keymap_name");
177 #ifdef FEAT_WINDOWS
178 status_redraw_curbuf();
179 #endif
180diff -Naur vim71.orig/src/edit.c vim71/src/edit.c
181--- vim71.orig/src/edit.c 2007-05-07 15:43:55.000000000 -0400
182+++ vim71/src/edit.c 2007-07-23 19:57:08.000000000 -0400
183@@ -7215,6 +7215,8 @@
184 p = ml_get_curline();
185 if (cin_iscase(p) || cin_isscopedecl(p) || cin_islabel(30))
186 return TRUE;
187+ /* Need to get the line again after cin_islabel(). */
188+ p = ml_get_curline();
189 if (curwin->w_cursor.col > 2
190 && p[curwin->w_cursor.col - 1] == ':'
191 && p[curwin->w_cursor.col - 2] == ':')
192diff -Naur vim71.orig/src/eval.c vim71/src/eval.c
193--- vim71.orig/src/eval.c 2007-05-07 15:47:32.000000000 -0400
194+++ vim71/src/eval.c 2007-07-23 19:57:09.000000000 -0400
195@@ -672,7 +672,7 @@
196 static void f_writefile __ARGS((typval_T *argvars, typval_T *rettv));
197
198 static int list2fpos __ARGS((typval_T *arg, pos_T *posp, int *fnump));
199-static pos_T *var2fpos __ARGS((typval_T *varp, int lnum, int *fnum));
200+static pos_T *var2fpos __ARGS((typval_T *varp, int dollar_lnum, int *fnum));
201 static int get_env_len __ARGS((char_u **arg));
202 static int get_id_len __ARGS((char_u **arg));
203 static int get_name_len __ARGS((char_u **arg, char_u **alias, int evaluate, int verbose));
204@@ -10136,7 +10136,13 @@
205 if (mch_isdir(fname))
206 rettv->vval.v_number = 0;
207 else
208+ {
209 rettv->vval.v_number = (varnumber_T)st.st_size;
210+
211+ /* non-perfect check for overflow */
212+ if ((off_t)rettv->vval.v_number != (off_t)st.st_size)
213+ rettv->vval.v_number = -2;
214+ }
215 }
216 else
217 rettv->vval.v_number = -1;
218@@ -13919,6 +13925,8 @@
219 /* If 'n' flag is used: restore cursor position. */
220 if (flags & SP_NOMOVE)
221 curwin->w_cursor = save_cursor;
222+ else
223+ curwin->w_set_curswant = TRUE;
224 theend:
225 p_ws = save_p_ws;
226
227@@ -16497,9 +16505,9 @@
228 * Returns NULL when there is an error.
229 */
230 static pos_T *
231-var2fpos(varp, lnum, fnum)
232+var2fpos(varp, dollar_lnum, fnum)
233 typval_T *varp;
234- int lnum; /* TRUE when $ is last line */
235+ int dollar_lnum; /* TRUE when $ is last line */
236 int *fnum; /* set to fnum for '0, 'A, etc. */
237 {
238 char_u *name;
239@@ -16512,6 +16520,7 @@
240 list_T *l;
241 int len;
242 int error = FALSE;
243+ listitem_T *li;
244
245 l = varp->vval.v_list;
246 if (l == NULL)
247@@ -16527,6 +16536,14 @@
248 if (error)
249 return NULL;
250 len = (long)STRLEN(ml_get(pos.lnum));
251+
252+ /* We accept "$" for the column number: last column. */
253+ li = list_find(l, 1L);
254+ if (li != NULL && li->li_tv.v_type == VAR_STRING
255+ && li->li_tv.vval.v_string != NULL
256+ && STRCMP(li->li_tv.vval.v_string, "$") == 0)
257+ pos.col = len + 1;
258+
259 /* Accept a position up to the NUL after the line. */
260 if (pos.col == 0 || (int)pos.col > len + 1)
261 return NULL; /* invalid column number */
262@@ -16559,7 +16576,7 @@
263 pos.coladd = 0;
264 #endif
265
266- if (name[0] == 'w' && lnum)
267+ if (name[0] == 'w' && dollar_lnum)
268 {
269 pos.col = 0;
270 if (name[1] == '0') /* "w0": first visible line */
271@@ -16577,7 +16594,7 @@
272 }
273 else if (name[0] == '$') /* last column or line */
274 {
275- if (lnum)
276+ if (dollar_lnum)
277 {
278 pos.lnum = curbuf->b_ml.ml_line_count;
279 pos.col = 0;
280diff -Naur vim71.orig/src/ex_cmds.c vim71/src/ex_cmds.c
281--- vim71.orig/src/ex_cmds.c 2007-05-07 15:41:01.000000000 -0400
282+++ vim71/src/ex_cmds.c 2007-07-23 19:57:09.000000000 -0400
283@@ -408,7 +408,11 @@
284 goto sortend;
285 }
286 *s = NUL;
287- regmatch.regprog = vim_regcomp(p + 1, RE_MAGIC);
288+ /* Use last search pattern if sort pattern is empty. */
289+ if (s == p + 1 && last_search_pat() != NULL)
290+ regmatch.regprog = vim_regcomp(last_search_pat(), RE_MAGIC);
291+ else
292+ regmatch.regprog = vim_regcomp(p + 1, RE_MAGIC);
293 if (regmatch.regprog == NULL)
294 goto sortend;
295 p = s; /* continue after the regexp */
296@@ -2912,22 +2916,35 @@
297 }
298
299 /*
300- * Check if a buffer is read-only. Ask for overruling in a dialog.
301- * Return TRUE and give an error message when the buffer is readonly.
302+ * Check if a buffer is read-only (either 'readonly' option is set or file is
303+ * read-only). Ask for overruling in a dialog. Return TRUE and give an error
304+ * message when the buffer is readonly.
305 */
306 static int
307 check_readonly(forceit, buf)
308 int *forceit;
309 buf_T *buf;
310 {
311- if (!*forceit && buf->b_p_ro)
312+ struct stat st;
313+
314+ /* Handle a file being readonly when the 'readonly' option is set or when
315+ * the file exists and permissions are read-only.
316+ * We will send 0777 to check_file_readonly(), as the "perm" variable is
317+ * important for device checks but not here. */
318+ if (!*forceit && (buf->b_p_ro
319+ || (mch_stat((char *)buf->b_ffname, &st) >= 0
320+ && check_file_readonly(buf->b_ffname, 0777))))
321 {
322 #if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)
323 if ((p_confirm || cmdmod.confirm) && buf->b_fname != NULL)
324 {
325 char_u buff[IOSIZE];
326
327- dialog_msg(buff, _("'readonly' option is set for \"%s\".\nDo you wish to write anyway?"),
328+ if (buf->b_p_ro)
329+ dialog_msg(buff, _("'readonly' option is set for \"%s\".\nDo you wish to write anyway?"),
330+ buf->b_fname);
331+ else
332+ dialog_msg(buff, _("File permissions of \"%s\" are read-only.\nIt may still be possible to write it.\nDo you wish to try?"),
333 buf->b_fname);
334
335 if (vim_dialog_yesno(VIM_QUESTION, NULL, buff, 2) == VIM_YES)
336@@ -2941,9 +2958,14 @@
337 }
338 else
339 #endif
340+ if (buf->b_p_ro)
341 EMSG(_(e_readonly));
342+ else
343+ EMSG2(_("E505: \"%s\" is read-only (add ! to override)"),
344+ buf->b_fname);
345 return TRUE;
346 }
347+
348 return FALSE;
349 }
350
351@@ -3367,7 +3389,7 @@
352 * was in this window (or another window). If not used
353 * before, reset the local window options to the global
354 * values. Also restores old folding stuff. */
355- get_winopts(buf);
356+ get_winopts(curbuf);
357 #ifdef FEAT_SPELL
358 did_get_winopts = TRUE;
359 #endif
360@@ -3649,8 +3671,8 @@
361 #ifdef FEAT_SPELL
362 /* If the window options were changed may need to set the spell language.
363 * Can only do this after the buffer has been properly setup. */
364- if (did_get_winopts && curwin->w_p_spell && *buf->b_p_spl != NUL)
365- did_set_spelllang(buf);
366+ if (did_get_winopts && curwin->w_p_spell && *curbuf->b_p_spl != NUL)
367+ did_set_spelllang(curbuf);
368 #endif
369
370 if (command == NULL)
371diff -Naur vim71.orig/src/ex_docmd.c vim71/src/ex_docmd.c
372--- vim71.orig/src/ex_docmd.c 2007-05-07 15:49:38.000000000 -0400
373+++ vim71/src/ex_docmd.c 2007-07-23 19:57:09.000000000 -0400
374@@ -133,6 +133,7 @@
375 static void get_flags __ARGS((exarg_T *eap));
376 #if !defined(FEAT_PERL) || !defined(FEAT_PYTHON) || !defined(FEAT_TCL) \
377 || !defined(FEAT_RUBY) || !defined(FEAT_MZSCHEME)
378+# define HAVE_EX_SCRIPT_NI
379 static void ex_script_ni __ARGS((exarg_T *eap));
380 #endif
381 static char_u *invalid_range __ARGS((exarg_T *eap));
382@@ -2118,7 +2119,11 @@
383 #ifdef FEAT_USR_CMDS
384 !USER_CMDIDX(ea.cmdidx) &&
385 #endif
386- cmdnames[ea.cmdidx].cmd_func == ex_ni);
387+ (cmdnames[ea.cmdidx].cmd_func == ex_ni
388+#ifdef HAVE_EX_SCRIPT_NI
389+ || cmdnames[ea.cmdidx].cmd_func == ex_script_ni
390+#endif
391+ ));
392
393 #ifndef FEAT_EVAL
394 /*
395@@ -3997,8 +4002,7 @@
396 eap->errmsg = (char_u *)N_("E319: Sorry, the command is not available in this version");
397 }
398
399-#if !defined(FEAT_PERL) || !defined(FEAT_PYTHON) || !defined(FEAT_TCL) \
400- || !defined(FEAT_RUBY) || !defined(FEAT_MZSCHEME)
401+#ifdef HAVE_EX_SCRIPT_NI
402 /*
403 * Function called for script command which is Not Implemented. NI!
404 * Skips over ":perl <<EOF" constructs.
405diff -Naur vim71.orig/src/ex_getln.c vim71/src/ex_getln.c
406--- vim71.orig/src/ex_getln.c 2007-05-07 15:47:23.000000000 -0400
407+++ vim71/src/ex_getln.c 2007-07-23 19:57:09.000000000 -0400
408@@ -484,7 +484,8 @@
409 if (xpc.xp_context == EXPAND_MENUNAMES && p_wmnu)
410 {
411 /* Hitting <Down> after "emenu Name.": complete submenu */
412- if (ccline.cmdbuff[ccline.cmdpos - 1] == '.' && c == K_DOWN)
413+ if (c == K_DOWN && ccline.cmdpos > 0
414+ && ccline.cmdbuff[ccline.cmdpos - 1] == '.')
415 c = p_wc;
416 else if (c == K_UP)
417 {
418@@ -533,9 +534,11 @@
419 upseg[3] = PATHSEP;
420 upseg[4] = NUL;
421
422- if (ccline.cmdbuff[ccline.cmdpos - 1] == PATHSEP
423- && c == K_DOWN
424- && (ccline.cmdbuff[ccline.cmdpos - 2] != '.'
425+ if (c == K_DOWN
426+ && ccline.cmdpos > 0
427+ && ccline.cmdbuff[ccline.cmdpos - 1] == PATHSEP
428+ && (ccline.cmdpos < 3
429+ || ccline.cmdbuff[ccline.cmdpos - 2] != '.'
430 || ccline.cmdbuff[ccline.cmdpos - 3] != '.'))
431 {
432 /* go down a directory */
433@@ -730,8 +733,8 @@
434 /* In Ex mode a backslash escapes a newline. */
435 if (exmode_active
436 && c != ESC
437- && ccline.cmdpos > 0
438 && ccline.cmdpos == ccline.cmdlen
439+ && ccline.cmdpos > 0
440 && ccline.cmdbuff[ccline.cmdpos - 1] == '\\')
441 {
442 if (c == K_KENTER)
443diff -Naur vim71.orig/src/fileio.c vim71/src/fileio.c
444--- vim71.orig/src/fileio.c 2007-05-10 07:29:44.000000000 -0400
445+++ vim71/src/fileio.c 2007-07-23 19:57:09.000000000 -0400
446@@ -44,6 +44,10 @@
447 /* Is there any system that doesn't have access()? */
448 #define USE_MCH_ACCESS
449
450+#if defined(sun) && defined(S_ISCHR)
451+# define OPEN_CHR_FILES
452+static int is_dev_fd_file(char_u *fname);
453+#endif
454 #ifdef FEAT_MBYTE
455 static char_u *next_fenc __ARGS((char_u **pp));
456 # ifdef FEAT_EVAL
457@@ -406,6 +410,10 @@
458 # ifdef S_ISSOCK
459 && !S_ISSOCK(perm) /* ... or socket */
460 # endif
461+# ifdef OPEN_CHR_FILES
462+ && !(S_ISCHR(perm) && is_dev_fd_file(fname))
463+ /* ... or a character special file named /dev/fd/<n> */
464+# endif
465 )
466 {
467 if (S_ISDIR(perm))
468@@ -424,7 +432,7 @@
469 */
470 if (!p_odev && mch_nodetype(fname) == NODE_WRITABLE)
471 {
472- filemess(curbuf, fname, (char_u *)_("is a device (disabled with 'opendevice' option"), 0);
473+ filemess(curbuf, fname, (char_u *)_("is a device (disabled with 'opendevice' option)"), 0);
474 msg_end();
475 msg_scroll = msg_save;
476 return FAIL;
477@@ -2265,6 +2273,13 @@
478 }
479 # endif
480 # endif
481+# ifdef OPEN_CHR_FILES
482+ if (S_ISCHR(perm)) /* or character special */
483+ {
484+ STRCAT(IObuff, _("[character special]"));
485+ c = TRUE;
486+ }
487+# endif
488 #endif
489 if (curbuf->b_p_ro)
490 {
491@@ -2464,6 +2479,25 @@
492 return OK;
493 }
494
495+#ifdef OPEN_CHR_FILES
496+/*
497+ * Returns TRUE if the file name argument is of the form "/dev/fd/\d\+",
498+ * which is the name of files used for process substitution output by
499+ * some shells on some operating systems, e.g., bash on SunOS.
500+ * Do not accept "/dev/fd/[012]", opening these may hang Vim.
501+ */
502+ static int
503+is_dev_fd_file(fname)
504+ char_u *fname;
505+{
506+ return (STRNCMP(fname, "/dev/fd/", 8) == 0
507+ && VIM_ISDIGIT(fname[8])
508+ && *skipdigits(fname + 9) == NUL
509+ && (fname[9] != NUL
510+ || (fname[8] != '0' && fname[8] != '1' && fname[8] != '2')));
511+}
512+#endif
513+
514 #ifdef FEAT_MBYTE
515
516 /*
517@@ -2734,6 +2768,32 @@
518 #endif
519
520 /*
521+ * Return TRUE if a file appears to be read-only from the file permissions.
522+ */
523+ int
524+check_file_readonly(fname, perm)
525+ char_u *fname; /* full path to file */
526+ int perm; /* known permissions on file */
527+{
528+#ifndef USE_MCH_ACCESS
529+ int fd = 0;
530+#endif
531+
532+ return (
533+#ifdef USE_MCH_ACCESS
534+# ifdef UNIX
535+ (perm & 0222) == 0 ||
536+# endif
537+ mch_access((char *)fname, W_OK)
538+#else
539+ (fd = mch_open((char *)fname, O_RDWR | O_EXTRA, 0)) < 0
540+ ? TRUE : (close(fd), FALSE)
541+#endif
542+ );
543+}
544+
545+
546+/*
547 * buf_write() - write to file "fname" lines "start" through "end"
548 *
549 * We do our own buffering here because fwrite() is so slow.
550@@ -3219,17 +3279,8 @@
551 * Check if the file is really writable (when renaming the file to
552 * make a backup we won't discover it later).
553 */
554- file_readonly = (
555-# ifdef USE_MCH_ACCESS
556-# ifdef UNIX
557- (perm & 0222) == 0 ||
558-# endif
559- mch_access((char *)fname, W_OK)
560-# else
561- (fd = mch_open((char *)fname, O_RDWR | O_EXTRA, 0)) < 0
562- ? TRUE : (close(fd), FALSE)
563-# endif
564- );
565+ file_readonly = check_file_readonly(fname, (int)perm);
566+
567 if (!forceit && file_readonly)
568 {
569 if (vim_strchr(p_cpo, CPO_FWRITE) != NULL)
570diff -Naur vim71.orig/src/gui_gtk.c vim71/src/gui_gtk.c
571--- vim71.orig/src/gui_gtk.c 2007-05-10 04:37:37.000000000 -0400
572+++ vim71/src/gui_gtk.c 2007-07-23 19:57:05.000000000 -0400
573@@ -53,8 +53,8 @@
574 # ifdef bindtextdomain
575 # undef bindtextdomain
576 # endif
577-# ifdef bindtextdomain_codeset
578-# undef bindtextdomain_codeset
579+# ifdef bind_textdomain_codeset
580+# undef bind_textdomain_codeset
581 # endif
582 # if defined(FEAT_GETTEXT) && !defined(ENABLE_NLS)
583 # define ENABLE_NLS /* so the texts in the dialog boxes are translated */
584diff -Naur vim71.orig/src/gui_gtk_x11.c vim71/src/gui_gtk_x11.c
585--- vim71.orig/src/gui_gtk_x11.c 2007-05-10 04:37:49.000000000 -0400
586+++ vim71/src/gui_gtk_x11.c 2007-07-23 19:57:08.000000000 -0400
587@@ -36,8 +36,8 @@
588 # ifdef bindtextdomain
589 # undef bindtextdomain
590 # endif
591-# ifdef bindtextdomain_codeset
592-# undef bindtextdomain_codeset
593+# ifdef bind_textdomain_codeset
594+# undef bind_textdomain_codeset
595 # endif
596 # if defined(FEAT_GETTEXT) && !defined(ENABLE_NLS)
597 # define ENABLE_NLS /* so the texts in the dialog boxes are translated */
598@@ -2188,8 +2188,10 @@
599 escaped_filename = vim_strsave_escaped(filename, escape_chars);
600 if (escaped_filename == NULL)
601 return FALSE;
602- mksession_cmdline = g_strconcat("mksession ", (char *)escaped_filename, NULL);
603+ mksession_cmdline = g_strconcat("mksession ", (char *)escaped_filename,
604+ NULL);
605 vim_free(escaped_filename);
606+
607 /*
608 * Use a reasonable hardcoded set of 'sessionoptions' flags to avoid
609 * unpredictable effects when the session is saved automatically. Also,
610@@ -2199,7 +2201,7 @@
611 */
612 save_ssop_flags = ssop_flags;
613 ssop_flags = (SSOP_BLANK|SSOP_CURDIR|SSOP_FOLDS|SSOP_GLOBALS
614- |SSOP_HELP|SSOP_OPTIONS|SSOP_WINSIZE);
615+ |SSOP_HELP|SSOP_OPTIONS|SSOP_WINSIZE|SSOP_TABPAGES);
616
617 do_cmdline_cmd((char_u *)"let Save_VV_this_session = v:this_session");
618 failed = (do_cmdline_cmd((char_u *)mksession_cmdline) == FAIL);
619diff -Naur vim71.orig/src/if_mzsch.c vim71/src/if_mzsch.c
620--- vim71.orig/src/if_mzsch.c 2007-05-12 07:13:47.000000000 -0400
621+++ vim71/src/if_mzsch.c 2007-07-23 19:57:09.000000000 -0400
622@@ -308,6 +308,8 @@
623 static Scheme_Config *(*dll_scheme_current_config)(void);
624 static Scheme_Object *(*dll_scheme_char_string_to_byte_string)
625 (Scheme_Object *s);
626+static Scheme_Object *(*dll_scheme_char_string_to_path)
627+ (Scheme_Object *s);
628 # endif
629
630 /* arrays are imported directly */
631@@ -398,6 +400,8 @@
632 # define scheme_current_config dll_scheme_current_config
633 # define scheme_char_string_to_byte_string \
634 dll_scheme_char_string_to_byte_string
635+# define scheme_char_string_to_path \
636+ dll_scheme_char_string_to_path
637 # endif
638
639 typedef struct
640@@ -498,6 +502,8 @@
641 {"scheme_current_config", (void **)&dll_scheme_current_config},
642 {"scheme_char_string_to_byte_string",
643 (void **)&dll_scheme_char_string_to_byte_string},
644+ {"scheme_char_string_to_path",
645+ (void **)&dll_scheme_char_string_to_path},
646 # endif
647 {NULL, NULL}};
648
649@@ -773,7 +779,14 @@
650 #ifdef MZSCHEME_COLLECTS
651 /* setup 'current-library-collection-paths' parameter */
652 scheme_set_param(scheme_config, MZCONFIG_COLLECTION_PATHS,
653- scheme_make_pair(scheme_make_string(MZSCHEME_COLLECTS),
654+ scheme_make_pair(
655+# if MZSCHEME_VERSION_MAJOR >= 299
656+ scheme_char_string_to_path(
657+ scheme_byte_string_to_char_string(
658+ scheme_make_byte_string(MZSCHEME_COLLECTS))),
659+# else
660+ scheme_make_string(MZSCHEME_COLLECTS),
661+# endif
662 scheme_null));
663 #endif
664 #ifdef HAVE_SANDBOX
665diff -Naur vim71.orig/src/main.c vim71/src/main.c
666--- vim71.orig/src/main.c 2007-05-07 15:38:44.000000000 -0400
667+++ vim71/src/main.c 2007-07-23 19:57:08.000000000 -0400
668@@ -1360,8 +1360,7 @@
669 p = vim_getenv((char_u *)"VIMRUNTIME", &mustfree);
670 if (p != NULL && *p != NUL)
671 {
672- STRCPY(NameBuff, p);
673- STRCAT(NameBuff, "/lang");
674+ vim_snprintf((char *)NameBuff, MAXPATHL, "%s/lang", p);
675 bindtextdomain(VIMPACKAGE, (char *)NameBuff);
676 }
677 if (mustfree)
678diff -Naur vim71.orig/src/message.c vim71/src/message.c
679--- vim71.orig/src/message.c 2007-05-07 15:31:59.000000000 -0400
680+++ vim71/src/message.c 2007-07-23 19:57:09.000000000 -0400
681@@ -3456,11 +3456,11 @@
682 /* advance to next hotkey and set default hotkey */
683 #ifdef FEAT_MBYTE
684 if (has_mbyte)
685- hotkp += (*mb_ptr2len)(hotkp);
686+ hotkp += STRLEN(hotkp);
687 else
688 #endif
689 ++hotkp;
690- (void)copy_char(r + 1, hotkp, TRUE);
691+ hotkp[copy_char(r + 1, hotkp, TRUE)] = NUL;
692 if (dfltbutton)
693 --dfltbutton;
694
695@@ -3493,7 +3493,7 @@
696 *msgp++ = (dfltbutton == 1) ? ']' : ')';
697
698 /* redefine hotkey */
699- (void)copy_char(r, hotkp, TRUE);
700+ hotkp[copy_char(r, hotkp, TRUE)] = NUL;
701 }
702 }
703 else
704@@ -3519,8 +3519,6 @@
705 *msgp++ = ':';
706 *msgp++ = ' ';
707 *msgp = NUL;
708- mb_ptr_adv(hotkp);
709- *hotkp = NUL;
710 }
711 else
712 {
713@@ -3555,8 +3553,9 @@
714 msgp = confirm_msg + 1 + STRLEN(message);
715 hotkp = hotk;
716
717- /* define first default hotkey */
718- (void)copy_char(buttons, hotkp, TRUE);
719+ /* Define first default hotkey. Keep the hotkey string NUL
720+ * terminated to avoid reading past the end. */
721+ hotkp[copy_char(buttons, hotkp, TRUE)] = NUL;
722
723 /* Remember where the choices start, displaying starts here when
724 * "hotkp" typed at the more prompt. */
725diff -Naur vim71.orig/src/normal.c vim71/src/normal.c
726--- vim71.orig/src/normal.c 2007-05-07 15:34:39.000000000 -0400
727+++ vim71/src/normal.c 2007-07-23 19:57:09.000000000 -0400
728@@ -6379,7 +6379,7 @@
729 */
730 else if (cap->nchar == 'p' || cap->nchar == 'P')
731 {
732- if (!checkclearopq(cap->oap))
733+ if (!checkclearop(cap->oap))
734 {
735 prep_redo_cmd(cap);
736 do_put(cap->oap->regname,
737diff -Naur vim71.orig/src/ops.c vim71/src/ops.c
738--- vim71.orig/src/ops.c 2007-05-07 15:33:47.000000000 -0400
739+++ vim71/src/ops.c 2007-07-23 19:57:09.000000000 -0400
740@@ -3404,7 +3404,9 @@
741
742 #ifdef FEAT_VIRTUALEDIT
743 col += curwin->w_cursor.coladd;
744- if (ve_flags == VE_ALL && curwin->w_cursor.coladd > 0)
745+ if (ve_flags == VE_ALL
746+ && (curwin->w_cursor.coladd > 0
747+ || endcol2 == curwin->w_cursor.col))
748 {
749 if (dir == FORWARD && c == NUL)
750 ++col;
751diff -Naur vim71.orig/src/option.c vim71/src/option.c
752--- vim71.orig/src/option.c 2007-05-01 07:26:10.000000000 -0400
753+++ vim71/src/option.c 2007-07-23 19:57:09.000000000 -0400
754@@ -8219,6 +8219,25 @@
755 varp = get_varp(&options[opt_idx]);
756 if (varp != NULL) /* hidden option is not changed */
757 {
758+ if (number == 0 && string != NULL)
759+ {
760+ int index;
761+
762+ /* Either we are given a string or we are setting option
763+ * to zero. */
764+ for (index = 0; string[index] == '0'; ++index)
765+ ;
766+ if (string[index] != NUL || index == 0)
767+ {
768+ /* There's another character after zeros or the string
769+ * is empty. In both cases, we are trying to set a
770+ * num option using a string. */
771+ EMSG3(_("E521: Number required: &%s = '%s'"),
772+ name, string);
773+ return; /* do nothing as we hit an error */
774+
775+ }
776+ }
777 if (flags & P_NUM)
778 (void)set_num_option(opt_idx, varp, number,
779 NULL, 0, opt_flags);
780@@ -10605,6 +10624,9 @@
781 file_ff_differs(buf)
782 buf_T *buf;
783 {
784+ /* In a buffer that was never loaded the options are not valid. */
785+ if (buf->b_flags & BF_NEVERLOADED)
786+ return FALSE;
787 if ((buf->b_flags & BF_NEW)
788 && buf->b_ml.ml_line_count == 1
789 && *ml_get_buf(buf, (linenr_T)1, FALSE) == NUL)
790diff -Naur vim71.orig/src/os_unix.h vim71/src/os_unix.h
791--- vim71.orig/src/os_unix.h 2007-05-07 15:35:05.000000000 -0400
792+++ vim71/src/os_unix.h 2007-07-23 19:57:09.000000000 -0400
793@@ -508,6 +508,9 @@
794 #if !defined(S_ISFIFO) && defined(S_IFIFO)
795 # define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
796 #endif
797+#if !defined(S_ISCHR) && defined(S_IFCHR)
798+# define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
799+#endif
800
801 /* Note: Some systems need both string.h and strings.h (Savage). However,
802 * some systems can't handle both, only use string.h in that case. */
803diff -Naur vim71.orig/src/popupmnu.c vim71/src/popupmnu.c
804--- vim71.orig/src/popupmnu.c 2007-03-24 16:07:39.000000000 -0400
805+++ vim71/src/popupmnu.c 2007-07-23 19:57:08.000000000 -0400
806@@ -466,7 +466,7 @@
807 set_option_value((char_u *)"bh", 0L,
808 (char_u *)"wipe", OPT_LOCAL);
809 set_option_value((char_u *)"diff", 0L,
810- (char_u *)"", OPT_LOCAL);
811+ NULL, OPT_LOCAL);
812 }
813 }
814 if (res == OK)
815diff -Naur vim71.orig/src/proto/fileio.pro vim71/src/proto/fileio.pro
816--- vim71.orig/src/proto/fileio.pro 2007-05-12 06:39:14.000000000 -0400
817+++ vim71/src/proto/fileio.pro 2007-07-23 19:57:08.000000000 -0400
818@@ -2,6 +2,7 @@
819 void filemess __ARGS((buf_T *buf, char_u *name, char_u *s, int attr));
820 int readfile __ARGS((char_u *fname, char_u *sfname, linenr_T from, linenr_T lines_to_skip, linenr_T lines_to_read, exarg_T *eap, int flags));
821 int prep_exarg __ARGS((exarg_T *eap, buf_T *buf));
822+int check_file_readonly __ARGS((char_u *fname, int perm));
823 int buf_write __ARGS((buf_T *buf, char_u *fname, char_u *sfname, linenr_T start, linenr_T end, exarg_T *eap, int append, int forceit, int reset_changed, int filtering));
824 void msg_add_fname __ARGS((buf_T *buf, char_u *fname));
825 void msg_add_lines __ARGS((int insert_space, long lnum, long nchars));
826diff -Naur vim71.orig/src/quickfix.c vim71/src/quickfix.c
827--- vim71.orig/src/quickfix.c 2007-02-03 19:50:17.000000000 -0500
828+++ vim71/src/quickfix.c 2007-07-23 19:57:08.000000000 -0400
829@@ -2331,7 +2331,7 @@
830 set_option_value((char_u *)"bt", 0L, (char_u *)"quickfix",
831 OPT_LOCAL);
832 set_option_value((char_u *)"bh", 0L, (char_u *)"wipe", OPT_LOCAL);
833- set_option_value((char_u *)"diff", 0L, (char_u *)"", OPT_LOCAL);
834+ set_option_value((char_u *)"diff", 0L, NULL, OPT_LOCAL);
835 }
836
837 /* Only set the height when still in the same tab page and there is no
838diff -Naur vim71.orig/src/screen.c vim71/src/screen.c
839--- vim71.orig/src/screen.c 2007-05-07 15:27:53.000000000 -0400
840+++ vim71/src/screen.c 2007-07-23 19:57:08.000000000 -0400
841@@ -3459,9 +3459,11 @@
842 #ifdef FEAT_DIFF
843 if (diff_hlf != (hlf_T)0)
844 {
845- if (diff_hlf == HLF_CHD && ptr - line >= change_start)
846+ if (diff_hlf == HLF_CHD && ptr - line >= change_start
847+ && n_extra == 0)
848 diff_hlf = HLF_TXD; /* changed text */
849- if (diff_hlf == HLF_TXD && ptr - line > change_end)
850+ if (diff_hlf == HLF_TXD && ptr - line > change_end
851+ && n_extra == 0)
852 diff_hlf = HLF_CHD; /* changed line */
853 line_attr = hl_attr(diff_hlf);
854 }
855diff -Naur vim71.orig/src/search.c vim71/src/search.c
856--- vim71.orig/src/search.c 2007-05-07 15:42:02.000000000 -0400
857+++ vim71/src/search.c 2007-07-23 19:57:09.000000000 -0400
858@@ -573,8 +573,12 @@
859 /*
860 * Start searching in current line, unless searching backwards and
861 * we're in column 0.
862+ * If we are searching backwards, in column 0, and not including the
863+ * current position, gain some efficiency by skipping back a line.
864+ * Otherwise begin the search in the current line.
865 */
866- if (dir == BACKWARD && start_pos.col == 0)
867+ if (dir == BACKWARD && start_pos.col == 0
868+ && (options & SEARCH_START) == 0)
869 {
870 lnum = pos->lnum - 1;
871 at_first_line = FALSE;
872@@ -2124,6 +2128,9 @@
873 else if (!backwards)
874 inquote = TRUE;
875 }
876+
877+ /* ml_get() only keeps one line, need to get linep again */
878+ linep = ml_get(pos.lnum);
879 }
880 }
881 }
882@@ -2795,7 +2802,7 @@
883 i = inc_cursor();
884 if (i == -1 || (i >= 1 && last_line)) /* started at last char in file */
885 return FAIL;
886- if (i == 1 && eol && count == 0) /* started at last char in line */
887+ if (i >= 1 && eol && count == 0) /* started at last char in line */
888 return OK;
889
890 /*
891@@ -3600,13 +3607,16 @@
892 {
893 oap->start = start_pos;
894 oap->motion_type = MCHAR;
895+ oap->inclusive = FALSE;
896 if (sol)
897- {
898 incl(&curwin->w_cursor);
899- oap->inclusive = FALSE;
900- }
901- else
902+ else if (lt(start_pos, curwin->w_cursor))
903+ /* Include the character under the cursor. */
904 oap->inclusive = TRUE;
905+ else
906+ /* End is before the start (no text in between <>, [], etc.): don't
907+ * operate on any text. */
908+ curwin->w_cursor = start_pos;
909 }
910
911 return OK;
912@@ -3734,7 +3744,7 @@
913
914 if (in_html_tag(FALSE))
915 {
916- /* cursor on start tag, move to just after it */
917+ /* cursor on start tag, move to its '>' */
918 while (*ml_get_cursor() != '>')
919 if (inc_cursor() < 0)
920 break;
921@@ -3838,7 +3848,7 @@
922 /* Exclude the start tag. */
923 curwin->w_cursor = start_pos;
924 while (inc_cursor() >= 0)
925- if (*ml_get_cursor() == '>' && lt(curwin->w_cursor, end_pos))
926+ if (*ml_get_cursor() == '>')
927 {
928 inc_cursor();
929 start_pos = curwin->w_cursor;
930@@ -3860,7 +3870,11 @@
931 #ifdef FEAT_VISUAL
932 if (VIsual_active)
933 {
934- if (*p_sel == 'e')
935+ /* If the end is before the start there is no text between tags, select
936+ * the char under the cursor. */
937+ if (lt(end_pos, start_pos))
938+ curwin->w_cursor = start_pos;
939+ else if (*p_sel == 'e')
940 ++curwin->w_cursor.col;
941 VIsual = start_pos;
942 VIsual_mode = 'v';
943@@ -3872,7 +3886,15 @@
944 {
945 oap->start = start_pos;
946 oap->motion_type = MCHAR;
947- oap->inclusive = TRUE;
948+ if (lt(end_pos, start_pos))
949+ {
950+ /* End is before the start: there is no text between tags; operate
951+ * on an empty area. */
952+ curwin->w_cursor = start_pos;
953+ oap->inclusive = FALSE;
954+ }
955+ else
956+ oap->inclusive = TRUE;
957 }
958 retval = OK;
959
960diff -Naur vim71.orig/src/syntax.c vim71/src/syntax.c
961--- vim71.orig/src/syntax.c 2007-05-07 15:42:55.000000000 -0400
962+++ vim71/src/syntax.c 2007-07-23 19:57:08.000000000 -0400
963@@ -4460,8 +4460,8 @@
964 current_syn_inc_tag = ++running_syn_inc_tag;
965 prev_toplvl_grp = curbuf->b_syn_topgrp;
966 curbuf->b_syn_topgrp = sgl_id;
967- if (source ? do_source(eap->arg, FALSE, FALSE) == FAIL
968- : source_runtime(eap->arg, DOSO_NONE) == FAIL)
969+ if (source ? do_source(eap->arg, FALSE, DOSO_NONE) == FAIL
970+ : source_runtime(eap->arg, TRUE) == FAIL)
971 EMSG2(_(e_notopen), eap->arg);
972 curbuf->b_syn_topgrp = prev_toplvl_grp;
973 current_syn_inc_tag = prev_syn_inc_tag;
974diff -Naur vim71.orig/src/version.c vim71/src/version.c
975--- vim71.orig/src/version.c 2007-05-12 06:23:44.000000000 -0400
976+++ vim71/src/version.c 2007-07-23 19:57:09.000000000 -0400
977@@ -667,6 +667,68 @@
978 static int included_patches[] =
979 { /* Add new patch number below this line */
980 /**/
981+ 33,
982+/**/
983+ 32,
984+/**/
985+ 31,
986+/**/
987+ 30,
988+/**/
989+ 29,
990+/**/
991+ 28,
992+/**/
993+ 27,
994+/**/
995+ 26,
996+/**/
997+ 25,
998+/**/
999+ 24,
1000+/**/
1001+ 23,
1002+/**/
1003+ 22,
1004+/**/
1005+ 21,
1006+/**/
1007+ 20,
1008+/**/
1009+ 19,
1010+/**/
1011+ 18,
1012+/**/
1013+ 17,
1014+/**/
1015+ 16,
1016+/**/
1017+ 15,
1018+/**/
1019+ 14,
1020+/**/
1021+ 13,
1022+/**/
1023+ 12,
1024+/**/
1025+ 11,
1026+/**/
1027+ 10,
1028+/**/
1029+ 9,
1030+/**/
1031+ 8,
1032+/**/
1033+ 6,
1034+/**/
1035+ 5,
1036+/**/
1037+ 4,
1038+/**/
1039+ 2,
1040+/**/
1041+ 1,
1042+/**/
1043 0
1044 };
1045
1046diff -Naur vim71.orig/src/vimtutor vim71/src/vimtutor
1047--- vim71.orig/src/vimtutor 2004-06-07 10:32:27.000000000 -0400
1048+++ vim71/src/vimtutor 2007-07-23 19:57:09.000000000 -0400
1049@@ -39,18 +39,22 @@
1050 # remove the copy of the tutor on exit
1051 trap "rm -rf $TODELETE" 0 1 2 3 9 11 13 15
1052
1053-# Vim could be called "vim" or "vi". Also check for "vim6", for people who
1054-# have Vim 5.x installed as "vim" and Vim 6.0 as "vim6".
1055-testvim=`which vim6 2>/dev/null`
1056-if test -f "$testvim"; then
1057- VIM=vim6
1058-else
1059- testvim=`which vim`
1060+# Vim could be called "vim" or "vi". Also check for "vimN", for people who
1061+# have Vim installed with its version number.
1062+# We anticipate up to a future Vim 8 version :-).
1063+seq="vim vim8 vim75 vim74 vim73 vim72 vim71 vim70 vim7 vim6 vi"
1064+for i in $seq; do
1065+ testvim=`which $i 2>/dev/null`
1066 if test -f "$testvim"; then
1067- VIM=vim
1068- else
1069- VIM=vi
1070+ VIM=$i
1071+ break
1072 fi
1073+done
1074+
1075+# When no Vim version was found fall back to "vim", you'll get an error message
1076+# below.
1077+if test -z "$VIM"; then
1078+ VIM=vim
1079 fi
1080
1081 # Use Vim to copy the tutor, it knows the value of $VIMRUNTIME
Note: See TracBrowser for help on using the repository browser.