• R/O
  • SSH

vim: Commit

Mirror of the Vim source from https://github.com/vim/vim


Commit MetaInfo

Révision7f2d3b3c15a2ffbd259c2ee99966124c2c2087ee (tree)
l'heure2005-08-02 07:02:32
Auteurvimboss
Commitervimboss

Message de Log

updated for version 7.0122

Change Summary

Modification

diff -r d9d38102399f -r 7f2d3b3c15a2 runtime/doc/todo.txt
--- a/runtime/doc/todo.txt Mon Aug 01 21:58:57 2005 +0000
+++ b/runtime/doc/todo.txt Mon Aug 01 22:02:32 2005 +0000
@@ -1,4 +1,4 @@
1-*todo.txt* For Vim version 7.0aa. Last change: 2005 Jul 31
1+*todo.txt* For Vim version 7.0aa. Last change: 2005 Aug 01
22
33
44 VIM REFERENCE MANUAL by Bram Moolenaar
@@ -30,11 +30,6 @@
3030 *known-bugs*
3131 -------------------- Known bugs and current work -----------------------
3232
33-Spell: For Italian we also need to postpone prefixes with a chop string.
34-Or handle upper/lower case specially?
35-
36-":w! /tmp/tt" gives ATTENTION message but no prompt.
37-
3833 Mac unicode patch (Da Woon Jung):
3934 - selecting proportional font breaks display
4035 - UTF-8 text causes display problems. Font replacement causes this.
@@ -1008,6 +1003,7 @@
10081003 ":w!!" for that.
10091004 Or ask for permission to overwrite it (if file can be made writable) and
10101005 restore file to readonly afterwards.
1006+ Overwriting a file for which a swap file exists is similar issue.
10111007 7 When compiled with "xterm_clipboard", startup can be slower and might get
10121008 error message for invalid $DISPLAY. Try connecting to the X server in the
10131009 background (forked), so that Vim starts up quicker? Connect as soon as
@@ -1619,7 +1615,6 @@
16191615 .vim file. Problem: distribution.
16201616 3. Use a cache directory for each user. How to recognize which cached
16211617 file belongs to a sourced script?
1622-7 Add "m" flag to search() and searchpair() function to set the '' mark.
16231618 7 Add argument to winwidth() to subtract the space taken by 'foldcolumn',
16241619 signs and/or 'number'.
16251620 8 Add functions:
@@ -1651,7 +1646,6 @@
16511646 virtualmode() add argument to obtain whether "$" was used in
16521647 Visual block mode.
16531648 getacp() Win32: get codepage (Glenn Maynard)
1654- getbufline() get line from any buffer
16551649 deletebufline() delete line in any buffer
16561650 appendbufline() append line in any buffer
16571651 libcall() Allow more than one argument.
@@ -3207,13 +3201,6 @@
32073201 6 Add ":timer" command, to set a command to be executed at a certain
32083202 interval, or once after some time has elapsed. (Aaron)
32093203 8 Add ":confirm" handling in open_exfile(), for when file already exists.
3210-8 Use confirm/dialog stuff to ask the user, when a file has changed outside
3211- of Vim, if he wants to reload it. Triggered when focus gained, after
3212- shell command, when entering another buffer, etc..
3213- Also do this when editing a new file, and another application creates
3214- the file before doing ":w" in Vim.
3215- Also check if the file protection has changed. When checking a file into
3216- RCS it is made read-only, when checking out it is made read-write.
32173204 8 When quitting with changed files, make the dialog list the changed file
32183205 and allow "write all", "discard all", "write some". The last one would
32193206 then ask "write" or "discard" for each changed file. Patch in HierAssist
diff -r d9d38102399f -r 7f2d3b3c15a2 runtime/doc/version7.txt
--- a/runtime/doc/version7.txt Mon Aug 01 21:58:57 2005 +0000
+++ b/runtime/doc/version7.txt Mon Aug 01 22:02:32 2005 +0000
@@ -1,4 +1,4 @@
1-*version7.txt* For Vim version 7.0aa. Last change: 2005 Jul 29
1+*version7.txt* For Vim version 7.0aa. Last change: 2005 Aug 01
22
33
44 VIM REFERENCE MANUAL by Bram Moolenaar
@@ -62,6 +62,9 @@
6262 ":echo 'a''b'" would result in "a b", but now that two quotes stand for one it
6363 results in "a'b".
6464
65+When overwriting a file with ":w! fname" there was no warning for when "fname"
66+was being edited by another Vim. Vim now gives an error message |E768|.
67+
6568
6669 Minor incompatibilities:
6770
diff -r d9d38102399f -r 7f2d3b3c15a2 src/ex_cmds.c
--- a/src/ex_cmds.c Mon Aug 01 21:58:57 2005 +0000
+++ b/src/ex_cmds.c Mon Aug 01 22:02:32 2005 +0000
@@ -2582,34 +2582,83 @@
25822582 || ((buf->b_flags & BF_NEW)
25832583 && vim_strchr(p_cpo, CPO_OVERNEW) == NULL)
25842584 || (buf->b_flags & BF_READERR))
2585- && !eap->forceit
2586- && !eap->append
25872585 && !p_wa
25882586 && vim_fexists(ffname))
25892587 {
2588+ if (!eap->forceit && !eap->append)
2589+ {
25902590 #ifdef UNIX
2591- /* with UNIX it is possible to open a directory */
2592- if (mch_isdir(ffname))
2593- {
2594- EMSG2(_(e_isadir2), ffname);
2595- return FAIL;
2596- }
2591+ /* with UNIX it is possible to open a directory */
2592+ if (mch_isdir(ffname))
2593+ {
2594+ EMSG2(_(e_isadir2), ffname);
2595+ return FAIL;
2596+ }
25972597 #endif
25982598 #if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)
2599- if (p_confirm || cmdmod.confirm)
2600- {
2601- char_u buff[IOSIZE];
2602-
2603- dialog_msg(buff, _("Overwrite existing file \"%s\"?"), fname);
2604- if (vim_dialog_yesno(VIM_QUESTION, NULL, buff, 2) != VIM_YES)
2599+ if (p_confirm || cmdmod.confirm)
2600+ {
2601+ char_u buff[IOSIZE];
2602+
2603+ dialog_msg(buff, _("Overwrite existing file \"%s\"?"), fname);
2604+ if (vim_dialog_yesno(VIM_QUESTION, NULL, buff, 2) != VIM_YES)
2605+ return FAIL;
2606+ eap->forceit = TRUE;
2607+ }
2608+ else
2609+#endif
2610+ {
2611+ EMSG(_(e_exists));
26052612 return FAIL;
2606- eap->forceit = TRUE;
2613+ }
26072614 }
2608- else
2609-#endif
2615+
2616+ /* For ":w! filename" check that no swap file exists for "filename". */
2617+ if (other && !emsg_silent)
26102618 {
2611- EMSG(_(e_exists));
2612- return FAIL;
2619+ char_u dir[MAXPATHL];
2620+ char_u *p;
2621+ int r;
2622+ char_u *swapname;
2623+
2624+ /* We only try the first entry in 'directory', without checking if
2625+ * it's writable. If the "." directory is not writable the write
2626+ * will probably fail anyway.
2627+ * Use 'shortname' of the current buffer, since there is no buffer
2628+ * for the written file. */
2629+ if (*p_dir == NUL)
2630+ STRCPY(dir, ".");
2631+ else
2632+ {
2633+ p = p_dir;
2634+ copy_option_part(&p, dir, MAXPATHL, ",");
2635+ }
2636+ swapname = makeswapname(fname, ffname, curbuf, dir);
2637+ r = vim_fexists(swapname);
2638+ vim_free(swapname);
2639+ if (r)
2640+ {
2641+#if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)
2642+ if (p_confirm || cmdmod.confirm)
2643+ {
2644+ char_u buff[IOSIZE];
2645+
2646+ dialog_msg(buff,
2647+ _("Swap file \"%s\" exists, overwrite anyway?"),
2648+ swapname);
2649+ if (vim_dialog_yesno(VIM_QUESTION, NULL, buff, 2)
2650+ != VIM_YES)
2651+ return FAIL;
2652+ eap->forceit = TRUE;
2653+ }
2654+ else
2655+#endif
2656+ {
2657+ EMSG2(_("E768: Swap file exists: %s (:silent! overrides)"),
2658+ swapname);
2659+ return FAIL;
2660+ }
2661+ }
26132662 }
26142663 }
26152664 return OK;
diff -r d9d38102399f -r 7f2d3b3c15a2 src/memline.c
--- a/src/memline.c Mon Aug 01 21:58:57 2005 +0000
+++ b/src/memline.c Mon Aug 01 22:02:32 2005 +0000
@@ -230,7 +230,6 @@
230230 static bhdr_T *ml_new_ptr __ARGS((memfile_T *));
231231 static bhdr_T *ml_find_line __ARGS((buf_T *, linenr_T, int));
232232 static int ml_add_stack __ARGS((buf_T *));
233-static char_u *makeswapname __ARGS((buf_T *, char_u *));
234233 static void ml_lineadd __ARGS((buf_T *, int));
235234 static int b0_magic_wrong __ARGS((ZERO_BL *));
236235 #ifdef CHECK_INODE
@@ -3384,10 +3383,14 @@
33843383 }
33853384
33863385 /*
3387- * make swap file name out of the file name and a directory name
3386+ * Make swap file name out of the file name and a directory name.
3387+ * Returns pointer to allocated memory or NULL.
33883388 */
3389- static char_u *
3390-makeswapname(buf, dir_name)
3389+/*ARGSUSED*/
3390+ char_u *
3391+makeswapname(fname, ffname, buf, dir_name)
3392+ char_u *fname;
3393+ char_u *ffname;
33913394 buf_T *buf;
33923395 char_u *dir_name;
33933396 {
@@ -3398,7 +3401,7 @@
33983401 if (after_pathsep(dir_name, s) && s[-1] == s[-2])
33993402 { /* Ends with '//', Use Full path */
34003403 r = NULL;
3401- if ((s = make_percent_swname(dir_name, buf->b_fname)) != NULL)
3404+ if ((s = make_percent_swname(dir_name, fname)) != NULL)
34023405 {
34033406 r = modname(s, (char_u *)".swp", FALSE);
34043407 vim_free(s);
@@ -3415,9 +3418,9 @@
34153418 #endif
34163419 #ifdef RISCOS
34173420 /* Avoid problems if fname has special chars, eg <Wimp$Scrap> */
3418- buf->b_ffname,
3421+ ffname,
34193422 #else
3420- buf->b_fname,
3423+ fname,
34213424 #endif
34223425 (char_u *)
34233426 #if defined(VMS) || defined(RISCOS)
@@ -3495,6 +3498,7 @@
34953498 * Find out what name to use for the swap file for buffer 'buf'.
34963499 *
34973500 * Several names are tried to find one that does not exist
3501+ * Returns the name in allocated memory or NULL.
34983502 *
34993503 * Note: If BASENAMELEN is not correct, you will get error messages for
35003504 * not being able to open the swapfile
@@ -3547,7 +3551,7 @@
35473551 if (dir_name == NULL) /* out of memory */
35483552 fname = NULL;
35493553 else
3550- fname = makeswapname(buf, dir_name);
3554+ fname = makeswapname(buf->b_fname, buf->b_ffname, buf, dir_name);
35513555
35523556 for (;;)
35533557 {
@@ -3649,7 +3653,8 @@
36493653 {
36503654 buf->b_shortname = TRUE;
36513655 vim_free(fname);
3652- fname = makeswapname(buf, dir_name);
3656+ fname = makeswapname(buf->b_fname, buf->b_ffname,
3657+ buf, dir_name);
36533658 continue; /* try again with b_shortname set */
36543659 }
36553660 }
@@ -3719,7 +3724,8 @@
37193724 {
37203725 buf->b_shortname = TRUE;
37213726 vim_free(fname);
3722- fname = makeswapname(buf, dir_name);
3727+ fname = makeswapname(buf->b_fname, buf->b_ffname,
3728+ buf, dir_name);
37233729 continue; /* try again with '.' replaced with '_' */
37243730 }
37253731 }
diff -r d9d38102399f -r 7f2d3b3c15a2 src/proto/memline.pro
--- a/src/proto/memline.pro Mon Aug 01 21:58:57 2005 +0000
+++ b/src/proto/memline.pro Mon Aug 01 22:02:32 2005 +0000
@@ -24,6 +24,7 @@
2424 void ml_setmarked __ARGS((linenr_T lnum));
2525 linenr_T ml_firstmarked __ARGS((void));
2626 void ml_clearmarked __ARGS((void));
27+char_u *makeswapname __ARGS((char_u *fname, char_u *ffname, buf_T *buf, char_u *dir_name));
2728 char_u *get_file_in_dir __ARGS((char_u *fname, char_u *dname));
2829 void ml_setflags __ARGS((buf_T *buf));
2930 long ml_find_line_or_offset __ARGS((buf_T *buf, linenr_T lnum, long *offp));
Afficher sur ancien navigateur de dépôt.