0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

patch 7.4.2015

Problem:    When a file gets a name when writing it 'acd' is not effective.
            (Dan Church)
Solution:   Invoke DO_AUTOCHDIR after writing the file. (Allen Haim, closes
            #777, closes #803)  Add test_autochdir() to enable 'acd' before
            "starting" is reset.
This commit is contained in:
Bram Moolenaar
2016-07-09 23:40:45 +02:00
parent 32b808a4bd
commit 5c71994f4e
8 changed files with 48 additions and 3 deletions

View File

@@ -3059,6 +3059,7 @@ do_write(exarg_T *eap)
char_u *browse_file = NULL;
#endif
buf_T *alt_buf = NULL;
int name_was_missing;
if (not_writing()) /* check 'write' option */
return FAIL;
@@ -3226,6 +3227,8 @@ do_write(exarg_T *eap)
#endif
}
name_was_missing = curbuf->b_ffname == NULL;
retval = buf_write(curbuf, ffname, fname, eap->line1, eap->line2,
eap, eap->append, eap->forceit, TRUE, FALSE);
@@ -3239,7 +3242,12 @@ do_write(exarg_T *eap)
redraw_tabline = TRUE;
#endif
}
/* Change directories when the 'acd' option is set. */
}
/* Change directories when the 'acd' option is set and the file name
* got changed or set. */
if (eap->cmdidx == CMD_saveas || name_was_missing)
{
DO_AUTOCHDIR
}
}