# HG changeset patch # User Bram Moolenaar # Date 1597003204 -7200 # Node ID 5b0796787cb27ae7c920d5b54f5dd7884daf301a # Parent 82bccdf79495e96406263eed2278359f77ec6d4f patch 8.2.1411: when splitting a window localdir is copied but prevdir is not Commit: https://github.com/vim/vim/commit/a9a47d157ab1946d1e286c9695bc68d71305af68 Author: Bram Moolenaar Date: Sun Aug 9 21:45:52 2020 +0200 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 https://github.com/vim/vim/issues/6667) diff --git a/src/clientserver.c b/src/clientserver.c --- a/src/clientserver.c +++ b/src/clientserver.c @@ -596,7 +596,8 @@ build_drop_cmd( ga_concat(&ga, cdp); // Call inputsave() so that a prompt for an encryption key works. - ga_concat(&ga, (char_u *)":if exists('*inputsave')|call inputsave()|endif|"); + ga_concat(&ga, (char_u *) + ":if exists('*inputsave')|call inputsave()|endif|"); if (tabs) ga_concat(&ga, (char_u *)"tab "); ga_concat(&ga, (char_u *)"drop"); @@ -621,7 +622,8 @@ build_drop_cmd( ga_concat(&ga, p); vim_free(p); } - ga_concat(&ga, (char_u *)"|if exists('*inputrestore')|call inputrestore()|endif"); + ga_concat(&ga, (char_u *) + "|if exists('*inputrestore')|call inputrestore()|endif"); // The :drop commands goes to Insert mode when 'insertmode' is set, use // CTRL-\ CTRL-N again. diff --git a/src/testdir/test_cd.vim b/src/testdir/test_cd.vim --- a/src/testdir/test_cd.vim +++ b/src/testdir/test_cd.vim @@ -168,6 +168,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_completion() call mkdir('XComplDir1', 'p') call mkdir('XComplDir2', 'p') diff --git a/src/version.c b/src/version.c --- a/src/version.c +++ b/src/version.c @@ -755,6 +755,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 1411, +/**/ 1410, /**/ 1409, diff --git a/src/window.c b/src/window.c --- a/src/window.c +++ b/src/window.c @@ -1385,6 +1385,8 @@ win_init(win_T *newp, win_T *oldp, int f #endif 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++)