diff src/ex_docmd.c @ 26171:fa8161b003f6 v8.2.3617

patch 8.2.3617: ":verbose pwd" does not mention 'autochdir' was applied Commit: https://github.com/vim/vim/commit/0526815c15170a5926e1008600ec29d42d8b64c2 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Nov 18 18:53:45 2021 +0000 patch 8.2.3617: ":verbose pwd" does not mention 'autochdir' was applied Problem: ":verbose pwd" does not mention 'autochdir' was applied. Solution: Remember the last chdir was done by 'autochdir'. (issue https://github.com/vim/vim/issues/9142)
author Bram Moolenaar <Bram@vim.org>
date Thu, 18 Nov 2021 20:00:06 +0100
parents e353ace59e62
children 027c5b4b6f07
line wrap: on
line diff
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -7390,6 +7390,7 @@ changedir_func(
 
 	if (dir_differs)
 	{
+	    last_chdir_reason = NULL;
 	    if (scope == CDSCOPE_WINDOW)
 		acmd_fname = (char_u *)"window";
 	    else if (scope == CDSCOPE_TABPAGE)
@@ -7453,7 +7454,9 @@ ex_pwd(exarg_T *eap UNUSED)
 	{
 	    char *context = "global";
 
-	    if (curwin->w_localdir != NULL)
+	    if (last_chdir_reason != NULL)
+		context = last_chdir_reason;
+	    else if (curwin->w_localdir != NULL)
 		context = "window";
 	    else if (curtab->tp_localdir != NULL)
 		context = "tabpage";