aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2021-10-17 22:04:53 +0800
committerzeertzjq <zeertzjq@outlook.com>2021-10-17 22:04:53 +0800
commit36290a2ebd3d49fa43f90fbdbf32e0cbe4f76d87 (patch)
tree62c562702008c702cc285494ae94b747163793a5 /src
parent60584c0245a55d72422686aa702132814145b0c1 (diff)
downloadrneovim-36290a2ebd3d49fa43f90fbdbf32e0cbe4f76d87.tar.gz
rneovim-36290a2ebd3d49fa43f90fbdbf32e0cbe4f76d87.tar.bz2
rneovim-36290a2ebd3d49fa43f90fbdbf32e0cbe4f76d87.zip
vim-patch:8.2.1411: when splitting a window localdir is copied but prevdir is not
Problem: when splitting a window localdir is copied but prevdir is not. Solution: Also copy prevdir. (closes vim/vim#6667) https://github.com/vim/vim/commit/a9a47d157ab1946d1e286c9695bc68d71305af68
Diffstat (limited to 'src')
-rw-r--r--src/nvim/testdir/test_cd.vim9
-rw-r--r--src/nvim/window.c2
2 files changed, 11 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_cd.vim b/src/nvim/testdir/test_cd.vim
index 36135b52ce..0bba321ee2 100644
--- a/src/nvim/testdir/test_cd.vim
+++ b/src/nvim/testdir/test_cd.vim
@@ -192,6 +192,15 @@ func Test_prev_dir()
call delete('Xdir', 'rf')
endfunc
+func Test_lcd_split()
+ let curdir = getcwd()
+ lcd ..
+ split
+ lcd -
+ call assert_equal(curdir, getcwd())
+ quit!
+endfunc
+
func Test_cd_from_non_existing_dir()
CheckNotMSWindows
diff --git a/src/nvim/window.c b/src/nvim/window.c
index db71512a3b..b841b219b2 100644
--- a/src/nvim/window.c
+++ b/src/nvim/window.c
@@ -1463,6 +1463,8 @@ static void win_init(win_T *newp, win_T *oldp, int flags)
}
newp->w_localdir = (oldp->w_localdir == NULL)
? NULL : vim_strsave(oldp->w_localdir);
+ newp->w_prevdir = (oldp->w_prevdir == NULL)
+ ? NULL : vim_strsave(oldp->w_prevdir);
// copy tagstack and folds
for (i = 0; i < oldp->w_tagstacklen; i++) {