]> granicus.if.org Git - vim/commitdiff
patch 8.2.1411: when splitting a window localdir is copied but prevdir is not v8.2.1411
authorBram Moolenaar <Bram@vim.org>
Sun, 9 Aug 2020 19:45:52 +0000 (21:45 +0200)
committerBram Moolenaar <Bram@vim.org>
Sun, 9 Aug 2020 19:45:52 +0000 (21:45 +0200)
Problem:    when splitting a window localdir is copied but prevdir is not.
Solution:   Also copy prevdir. (closes #6667)

src/clientserver.c
src/testdir/test_cd.vim
src/version.c
src/window.c

index fbbeb6a4bf01f1193036d2fdf7e9c16cad9b6421..7215aa7ffb1aac83a278349b01b858b79671a627 100644 (file)
@@ -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 *)"<CR>:if exists('*inputsave')|call inputsave()|endif|");
+    ga_concat(&ga, (char_u *)
+                      "<CR>: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<CR>");
+    ga_concat(&ga, (char_u *)
+                 "|if exists('*inputrestore')|call inputrestore()|endif<CR>");
 
     // The :drop commands goes to Insert mode when 'insertmode' is set, use
     // CTRL-\ CTRL-N again.
index bd6e3d9a53b33abc1bd7a3b7d3ff6e627c8dadf7..8a0fbb247d0f057694cae18aba8d80c84a5f0e88 100644 (file)
@@ -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')
index e290ea29cae8aa315b311f2cd72d31b09ba66515..64eca6bfabaea9e6408f94b0e35b75467671bf0b 100644 (file)
@@ -754,6 +754,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1411,
 /**/
     1410,
 /**/
index 7d8122efdd00eb288f75e7d1e8a68fa9c4af4816..d2e5c5c2af4e6f7fcdac86be764fe990b3d1a3a0 100644 (file)
@@ -1385,6 +1385,8 @@ win_init(win_T *newp, win_T *oldp, int flags UNUSED)
 #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++)