diff options
author | zeertzjq <zeertzjq@outlook.com> | 2021-11-19 20:07:04 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2021-11-19 20:07:04 +0800 |
commit | 3d504f27a002b3ce6acf75398789a37611b35c44 (patch) | |
tree | 416fd401bf31eb50f601ff3ae2b5dfcc57d215a5 /src/nvim/eval/funcs.c | |
parent | 54e9cce61274c89e4d8cd80832faecf67724e834 (diff) | |
download | rneovim-3d504f27a002b3ce6acf75398789a37611b35c44.tar.gz rneovim-3d504f27a002b3ce6acf75398789a37611b35c44.tar.bz2 rneovim-3d504f27a002b3ce6acf75398789a37611b35c44.zip |
vim-patch:8.2.3618: getcwd() is unclear about how 'autochdir' is used
Problem: getcwd() is unclear about how 'autochdir' is used.
Solution: Update the help for getcwd(). Without any arguments always return
the actual current directory. (closes vim/vim#9142)
https://github.com/vim/vim/commit/851c7a699ae00bdc14a4db874cf722b7b7393b53
Diffstat (limited to 'src/nvim/eval/funcs.c')
-rw-r--r-- | src/nvim/eval/funcs.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/src/nvim/eval/funcs.c b/src/nvim/eval/funcs.c index 7549ec7ac8..3cc5b49f8f 100644 --- a/src/nvim/eval/funcs.c +++ b/src/nvim/eval/funcs.c @@ -3485,11 +3485,6 @@ static void f_getcwd(typval_T *argvars, typval_T *rettv, FunPtr fptr) } } - // If the user didn't specify anything, default to window scope - if (scope == kCdScopeInvalid) { - scope = MIN_CD_SCOPE; - } - // Find the tabpage by number if (scope_number[kCdScopeTabpage] > 0) { tp = find_tabpage(scope_number[kCdScopeTabpage]); @@ -3535,12 +3530,13 @@ static void f_getcwd(typval_T *argvars, typval_T *rettv, FunPtr fptr) case kCdScopeGlobal: if (globaldir) { // `globaldir` is not always set. from = globaldir; - } else if (os_dirname(cwd, MAXPATHL) == FAIL) { // Get the OS CWD. + break; + } + FALLTHROUGH; // In global directory, just need to get OS CWD. + case kCdScopeInvalid: // If called without any arguments, get OS CWD. + if (os_dirname(cwd, MAXPATHL) == FAIL) { from = (char_u *)""; // Return empty string on failure. } - break; - case kCdScopeInvalid: // We should never get here - abort(); } if (from) { |