summaryrefslogtreecommitdiff
path: root/src/fileio.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2004-12-19 22:46:22 +0000
committerBram Moolenaar <Bram@vim.org>2004-12-19 22:46:22 +0000
commit1cd871b5341bf43ee99e136844e3131014880f92 (patch)
tree6bd9573dbc14de3c4ec85e424cbec9c8d1ee0ed8 /src/fileio.c
parent46c9c73de8def79baf8f0a34a12549f6c14944f3 (diff)
downloadvim-git-1cd871b5341bf43ee99e136844e3131014880f92.tar.gz
updated for version 7.0023v7.0023
Diffstat (limited to 'src/fileio.c')
-rw-r--r--src/fileio.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/src/fileio.c b/src/fileio.c
index c37c96a1d..d33718d12 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -370,13 +370,8 @@ readfile(fname, sfname, from, lines_to_skip, lines_to_read, eap, flags)
*/
if (fname != NULL && *fname != NUL)
{
- p = fname + STRLEN(fname) - 1;
- if ((vim_ispathsep(*p)
-#ifdef FEAT_MBYTE
- /* Do not use a multi-byte char as path separator. */
- && (!has_mbyte || (*mb_head_off)(fname, p) == 0)
-#endif
- ) || STRLEN(fname) >= MAXPATHL)
+ p = fname + STRLEN(fname);
+ if (after_pathsep(fname, p) || STRLEN(fname) >= MAXPATHL)
{
filemess(curbuf, fname, (char_u *)_("Illegal file name"), 0);
msg_end();
@@ -2801,7 +2796,8 @@ buf_write(buf, fname, sfname, start, end, eap, append, forceit,
ml_timestamp(buf);
buf->b_flags &= ~BF_WRITE_MASK;
}
- if (reset_changed && buf->b_changed)
+ if (reset_changed && buf->b_changed
+ && (overwriting || vim_strchr(p_cpo, CPO_PLUS) != NULL))
/* Buffer still changed, the autocommands didn't work
* properly. */
return FAIL;
@@ -3526,7 +3522,7 @@ buf_write(buf, fname, sfname, start, end, eap, append, forceit,
* the original file.
* Don't do this if there is a backup file and we are exiting.
*/
- if (reset_changed && !newfile && !otherfile(ffname)
+ if (reset_changed && !newfile && overwriting
&& !(exiting && backup != NULL))
{
ml_preserve(buf, FALSE);
@@ -4192,11 +4188,14 @@ restore_backup:
keep_msg_attr = 0;
}
+ /* When written everything correctly: reset 'modified'. Unless not
+ * writing to the original file and '+' is not in 'cpoptions'. */
if (reset_changed && whole
#ifdef FEAT_MBYTE
&& !write_info.bw_conv_error
#endif
- ) /* when written everything correctly */
+ && (overwriting || vim_strchr(p_cpo, CPO_PLUS) != NULL)
+ )
{
unchanged(buf, TRUE);
u_unchanged(buf);
@@ -5383,7 +5382,7 @@ buf_modname(shortname, fname, ext, prepend_dot)
vim_free(retval);
return NULL;
}
- if (!vim_ispathsep(retval[fnamelen - 1]))
+ if (!after_pathsep(retval, retval + fnamelen))
{
retval[fnamelen++] = PATHSEP;
retval[fnamelen] = NUL;
@@ -5410,7 +5409,7 @@ buf_modname(shortname, fname, ext, prepend_dot)
* Then truncate what is after the '/', '\' or ':' to 8 characters for
* MSDOS and 26 characters for AMIGA, a lot more for UNIX.
*/
- for (ptr = retval + fnamelen; ptr >= retval; ptr--)
+ for (ptr = retval + fnamelen; ptr >= retval; mb_ptr_back(retval, ptr))
{
#ifndef RISCOS
if (*ext == '.'