vim-patch:8.1.0602: DirChanged is also triggered when directory didn't change

Problem:    DirChanged is also triggered when the directory didn't change.
            (Daniel Hahler)
Solution:   Compare the current with the new directory. (closes vim/vim#3697)
2caad3fbbd
This commit is contained in:
zeertzjq
2021-10-17 22:04:53 +08:00
parent eed89d5e0c
commit e91dee5c21
4 changed files with 67 additions and 15 deletions

View File

@@ -7811,10 +7811,11 @@ void ex_cd(exarg_T *eap)
break;
}
if (vim_chdir(new_dir)) {
bool dir_differs = prev_dir == NULL || STRCMP(prev_dir, new_dir) != 0;
if (dir_differs && vim_chdir(new_dir)) {
EMSG(_(e_failed));
} else {
post_chdir(scope, true);
post_chdir(scope, dir_differs);
// Echo the new current directory if the command was typed.
if (KeyTyped || p_verbose >= 5) {
ex_pwd(eap);