Mirror of the Vim source from https://github.com/vim/vim
Révision | 7f2d3b3c15a2ffbd259c2ee99966124c2c2087ee (tree) |
---|---|
l'heure | 2005-08-02 07:02:32 |
Auteur | vimboss |
Commiter | vimboss |
updated for version 7.0122
@@ -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 | |
2 | 2 | |
3 | 3 | |
4 | 4 | VIM REFERENCE MANUAL by Bram Moolenaar |
@@ -30,11 +30,6 @@ | ||
30 | 30 | *known-bugs* |
31 | 31 | -------------------- Known bugs and current work ----------------------- |
32 | 32 | |
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 | - | |
38 | 33 | Mac unicode patch (Da Woon Jung): |
39 | 34 | - selecting proportional font breaks display |
40 | 35 | - UTF-8 text causes display problems. Font replacement causes this. |
@@ -1008,6 +1003,7 @@ | ||
1008 | 1003 | ":w!!" for that. |
1009 | 1004 | Or ask for permission to overwrite it (if file can be made writable) and |
1010 | 1005 | restore file to readonly afterwards. |
1006 | + Overwriting a file for which a swap file exists is similar issue. | |
1011 | 1007 | 7 When compiled with "xterm_clipboard", startup can be slower and might get |
1012 | 1008 | error message for invalid $DISPLAY. Try connecting to the X server in the |
1013 | 1009 | background (forked), so that Vim starts up quicker? Connect as soon as |
@@ -1619,7 +1615,6 @@ | ||
1619 | 1615 | .vim file. Problem: distribution. |
1620 | 1616 | 3. Use a cache directory for each user. How to recognize which cached |
1621 | 1617 | file belongs to a sourced script? |
1622 | -7 Add "m" flag to search() and searchpair() function to set the '' mark. | |
1623 | 1618 | 7 Add argument to winwidth() to subtract the space taken by 'foldcolumn', |
1624 | 1619 | signs and/or 'number'. |
1625 | 1620 | 8 Add functions: |
@@ -1651,7 +1646,6 @@ | ||
1651 | 1646 | virtualmode() add argument to obtain whether "$" was used in |
1652 | 1647 | Visual block mode. |
1653 | 1648 | getacp() Win32: get codepage (Glenn Maynard) |
1654 | - getbufline() get line from any buffer | |
1655 | 1649 | deletebufline() delete line in any buffer |
1656 | 1650 | appendbufline() append line in any buffer |
1657 | 1651 | libcall() Allow more than one argument. |
@@ -3207,13 +3201,6 @@ | ||
3207 | 3201 | 6 Add ":timer" command, to set a command to be executed at a certain |
3208 | 3202 | interval, or once after some time has elapsed. (Aaron) |
3209 | 3203 | 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. | |
3217 | 3204 | 8 When quitting with changed files, make the dialog list the changed file |
3218 | 3205 | and allow "write all", "discard all", "write some". The last one would |
3219 | 3206 | then ask "write" or "discard" for each changed file. Patch in HierAssist |
@@ -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 | |
2 | 2 | |
3 | 3 | |
4 | 4 | VIM REFERENCE MANUAL by Bram Moolenaar |
@@ -62,6 +62,9 @@ | ||
62 | 62 | ":echo 'a''b'" would result in "a b", but now that two quotes stand for one it |
63 | 63 | results in "a'b". |
64 | 64 | |
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 | + | |
65 | 68 | |
66 | 69 | Minor incompatibilities: |
67 | 70 |
@@ -2582,34 +2582,83 @@ | ||
2582 | 2582 | || ((buf->b_flags & BF_NEW) |
2583 | 2583 | && vim_strchr(p_cpo, CPO_OVERNEW) == NULL) |
2584 | 2584 | || (buf->b_flags & BF_READERR)) |
2585 | - && !eap->forceit | |
2586 | - && !eap->append | |
2587 | 2585 | && !p_wa |
2588 | 2586 | && vim_fexists(ffname)) |
2589 | 2587 | { |
2588 | + if (!eap->forceit && !eap->append) | |
2589 | + { | |
2590 | 2590 | #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 | + } | |
2597 | 2597 | #endif |
2598 | 2598 | #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)); | |
2605 | 2612 | return FAIL; |
2606 | - eap->forceit = TRUE; | |
2613 | + } | |
2607 | 2614 | } |
2608 | - else | |
2609 | -#endif | |
2615 | + | |
2616 | + /* For ":w! filename" check that no swap file exists for "filename". */ | |
2617 | + if (other && !emsg_silent) | |
2610 | 2618 | { |
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 | + } | |
2613 | 2662 | } |
2614 | 2663 | } |
2615 | 2664 | return OK; |
@@ -230,7 +230,6 @@ | ||
230 | 230 | static bhdr_T *ml_new_ptr __ARGS((memfile_T *)); |
231 | 231 | static bhdr_T *ml_find_line __ARGS((buf_T *, linenr_T, int)); |
232 | 232 | static int ml_add_stack __ARGS((buf_T *)); |
233 | -static char_u *makeswapname __ARGS((buf_T *, char_u *)); | |
234 | 233 | static void ml_lineadd __ARGS((buf_T *, int)); |
235 | 234 | static int b0_magic_wrong __ARGS((ZERO_BL *)); |
236 | 235 | #ifdef CHECK_INODE |
@@ -3384,10 +3383,14 @@ | ||
3384 | 3383 | } |
3385 | 3384 | |
3386 | 3385 | /* |
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. | |
3388 | 3388 | */ |
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; | |
3391 | 3394 | buf_T *buf; |
3392 | 3395 | char_u *dir_name; |
3393 | 3396 | { |
@@ -3398,7 +3401,7 @@ | ||
3398 | 3401 | if (after_pathsep(dir_name, s) && s[-1] == s[-2]) |
3399 | 3402 | { /* Ends with '//', Use Full path */ |
3400 | 3403 | r = NULL; |
3401 | - if ((s = make_percent_swname(dir_name, buf->b_fname)) != NULL) | |
3404 | + if ((s = make_percent_swname(dir_name, fname)) != NULL) | |
3402 | 3405 | { |
3403 | 3406 | r = modname(s, (char_u *)".swp", FALSE); |
3404 | 3407 | vim_free(s); |
@@ -3415,9 +3418,9 @@ | ||
3415 | 3418 | #endif |
3416 | 3419 | #ifdef RISCOS |
3417 | 3420 | /* Avoid problems if fname has special chars, eg <Wimp$Scrap> */ |
3418 | - buf->b_ffname, | |
3421 | + ffname, | |
3419 | 3422 | #else |
3420 | - buf->b_fname, | |
3423 | + fname, | |
3421 | 3424 | #endif |
3422 | 3425 | (char_u *) |
3423 | 3426 | #if defined(VMS) || defined(RISCOS) |
@@ -3495,6 +3498,7 @@ | ||
3495 | 3498 | * Find out what name to use for the swap file for buffer 'buf'. |
3496 | 3499 | * |
3497 | 3500 | * Several names are tried to find one that does not exist |
3501 | + * Returns the name in allocated memory or NULL. | |
3498 | 3502 | * |
3499 | 3503 | * Note: If BASENAMELEN is not correct, you will get error messages for |
3500 | 3504 | * not being able to open the swapfile |
@@ -3547,7 +3551,7 @@ | ||
3547 | 3551 | if (dir_name == NULL) /* out of memory */ |
3548 | 3552 | fname = NULL; |
3549 | 3553 | else |
3550 | - fname = makeswapname(buf, dir_name); | |
3554 | + fname = makeswapname(buf->b_fname, buf->b_ffname, buf, dir_name); | |
3551 | 3555 | |
3552 | 3556 | for (;;) |
3553 | 3557 | { |
@@ -3649,7 +3653,8 @@ | ||
3649 | 3653 | { |
3650 | 3654 | buf->b_shortname = TRUE; |
3651 | 3655 | vim_free(fname); |
3652 | - fname = makeswapname(buf, dir_name); | |
3656 | + fname = makeswapname(buf->b_fname, buf->b_ffname, | |
3657 | + buf, dir_name); | |
3653 | 3658 | continue; /* try again with b_shortname set */ |
3654 | 3659 | } |
3655 | 3660 | } |
@@ -3719,7 +3724,8 @@ | ||
3719 | 3724 | { |
3720 | 3725 | buf->b_shortname = TRUE; |
3721 | 3726 | vim_free(fname); |
3722 | - fname = makeswapname(buf, dir_name); | |
3727 | + fname = makeswapname(buf->b_fname, buf->b_ffname, | |
3728 | + buf, dir_name); | |
3723 | 3729 | continue; /* try again with '.' replaced with '_' */ |
3724 | 3730 | } |
3725 | 3731 | } |
@@ -24,6 +24,7 @@ | ||
24 | 24 | void ml_setmarked __ARGS((linenr_T lnum)); |
25 | 25 | linenr_T ml_firstmarked __ARGS((void)); |
26 | 26 | void ml_clearmarked __ARGS((void)); |
27 | +char_u *makeswapname __ARGS((char_u *fname, char_u *ffname, buf_T *buf, char_u *dir_name)); | |
27 | 28 | char_u *get_file_in_dir __ARGS((char_u *fname, char_u *dname)); |
28 | 29 | void ml_setflags __ARGS((buf_T *buf)); |
29 | 30 | long ml_find_line_or_offset __ARGS((buf_T *buf, linenr_T lnum, long *offp)); |