diff options
author | zeertzjq <zeertzjq@outlook.com> | 2021-10-17 22:04:53 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2021-10-17 22:04:53 +0800 |
commit | e91dee5c21ffca22ac821336ad23bce6339b5f7c (patch) | |
tree | 255c0c0e08203f8af3badb29d858460a0bcee6ee /src/nvim/ex_docmd.c | |
parent | eed89d5e0c3bd6870e6e9959ccfdbf99549dce6b (diff) | |
download | rneovim-e91dee5c21ffca22ac821336ad23bce6339b5f7c.tar.gz rneovim-e91dee5c21ffca22ac821336ad23bce6339b5f7c.tar.bz2 rneovim-e91dee5c21ffca22ac821336ad23bce6339b5f7c.zip |
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)
https://github.com/vim/vim/commit/2caad3fbbdbf1486a176c9f6bfbc3d9be90e09f7
Diffstat (limited to 'src/nvim/ex_docmd.c')
-rw-r--r-- | src/nvim/ex_docmd.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index 5d83e2218b..b81aab9ffe 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -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); |