Skip to content

Commit a9a47d1

Browse files
committed
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 #6667)
1 parent 7f7a888 commit a9a47d1

4 files changed

Lines changed: 17 additions & 2 deletions

File tree

src/clientserver.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -596,7 +596,8 @@ build_drop_cmd(
596596
ga_concat(&ga, cdp);
597597

598598
// Call inputsave() so that a prompt for an encryption key works.
599-
ga_concat(&ga, (char_u *)"<CR>:if exists('*inputsave')|call inputsave()|endif|");
599+
ga_concat(&ga, (char_u *)
600+
"<CR>:if exists('*inputsave')|call inputsave()|endif|");
600601
if (tabs)
601602
ga_concat(&ga, (char_u *)"tab ");
602603
ga_concat(&ga, (char_u *)"drop");
@@ -621,7 +622,8 @@ build_drop_cmd(
621622
ga_concat(&ga, p);
622623
vim_free(p);
623624
}
624-
ga_concat(&ga, (char_u *)"|if exists('*inputrestore')|call inputrestore()|endif<CR>");
625+
ga_concat(&ga, (char_u *)
626+
"|if exists('*inputrestore')|call inputrestore()|endif<CR>");
625627

626628
// The :drop commands goes to Insert mode when 'insertmode' is set, use
627629
// CTRL-\ CTRL-N again.

src/testdir/test_cd.vim

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,15 @@ func Test_prev_dir()
168168
call delete('Xdir', 'rf')
169169
endfunc
170170

171+
func Test_lcd_split()
172+
let curdir = getcwd()
173+
lcd ..
174+
split
175+
lcd -
176+
call assert_equal(curdir, getcwd())
177+
quit!
178+
endfunc
179+
171180
func Test_cd_completion()
172181
call mkdir('XComplDir1', 'p')
173182
call mkdir('XComplDir2', 'p')

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -754,6 +754,8 @@ static char *(features[]) =
754754

755755
static int included_patches[] =
756756
{ /* Add new patch number below this line */
757+
/**/
758+
1411,
757759
/**/
758760
1410,
759761
/**/

src/window.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1385,6 +1385,8 @@ win_init(win_T *newp, win_T *oldp, int flags UNUSED)
13851385
#endif
13861386
newp->w_localdir = (oldp->w_localdir == NULL)
13871387
? NULL : vim_strsave(oldp->w_localdir);
1388+
newp->w_prevdir = (oldp->w_prevdir == NULL)
1389+
? NULL : vim_strsave(oldp->w_prevdir);
13881390

13891391
// copy tagstack and folds
13901392
for (i = 0; i < oldp->w_tagstacklen; i++)

0 commit comments

Comments
 (0)