patch 9.1.1450: Session has wrong arglist with :tcd and :arglocal

Commit: 
https://github.com/vim/vim/commit/a304e49790280d9e3201648eb5ec8ba1ac55b175
Author: zeertzjq <zeert...@outlook.com>
Date:   Tue Jun 10 20:31:44 2025 +0200

    patch 9.1.1450: Session has wrong arglist with :tcd and :arglocal
    
    Problem:  Session has wrong arglist with :tcd and :arglocal.
    Solution: Also use absolute path for :argadd when there is tabpage-local
              directory (zeertzjq).
    
    related: neovim/neovim#34405
    closes: #17503
    
    Signed-off-by: zeertzjq <zeert...@outlook.com>
    Signed-off-by: Christian Brabandt <c...@256bit.org>

diff --git a/src/arglist.c b/src/arglist.c
index 4eec079df..bfc8bbd12 100644
--- a/src/arglist.c
+++ b/src/arglist.c
@@ -561,7 +561,7 @@ check_arg_idx(win_T *win)
 }
 
 /*
- * ":args", ":argslocal" and ":argsglobal".
+ * ":args", ":arglocal" and ":argglobal".
  */
     void
 ex_args(exarg_T *eap)
diff --git a/src/session.c b/src/session.c
index 8dd0bc364..34ecd9fe8 100644
--- a/src/session.c
+++ b/src/session.c
@@ -301,6 +301,7 @@ put_view_curpos(FILE *fd, win_T *wp, char *spaces)
 put_view(
     FILE       *fd,
     win_T      *wp,
+    tabpage_T  *tp,
     int                add_edit,            // add ":edit" command to view
     unsigned   *flagp,              // vop_flags or ssop_flags
     int                current_arg_idx,     // current argument index of the 
window,
@@ -328,6 +329,7 @@ put_view(
        if (ses_arglist(fd, "arglocal", &wp->w_alist->al_ga,
                        flagp == &vop_flags
                        || !(*flagp & SSOP_CURDIR)
+                       || tp->tp_localdir != NULL
                        || wp->w_localdir != NULL, flagp) == FAIL)
            return FAIL;
     }
@@ -899,7 +901,8 @@ makeopens(
        {
            if (!ses_do_win(wp))
                continue;
-           if (put_view(fd, wp, wp != edited_win, &ssop_flags, cur_arg_idx,
+           if (put_view(fd, wp, tp, wp != edited_win, &ssop_flags,
+                                                        cur_arg_idx,
 #ifdef FEAT_TERMINAL
                                                         &terminal_bufs
 #else
@@ -1335,8 +1338,8 @@ ex_mkrc(exarg_T   *eap)
            }
            else
            {
-               failed |= (put_view(fd, curwin, !using_vdir, flagp, -1, NULL)
-                                                                     == FAIL);
+               failed |= (put_view(fd, curwin, curtab, !using_vdir, flagp, -1,
+                                                               NULL) == FAIL);
            }
            if (put_line(fd, "let &g:so = s:so_save | let &g:siso = 
s:siso_save")
                                                                      == FAIL)
diff --git a/src/testdir/test_mksession.vim b/src/testdir/test_mksession.vim
index bbb42f94c..8217d91b8 100644
--- a/src/testdir/test_mksession.vim
+++ b/src/testdir/test_mksession.vim
@@ -32,6 +32,42 @@ func Test__mksession_arglocal()
   call delete('Xtest_mks.out')
 endfunc
 
+func Test_mksession_arglocal_localdir()
+  call mkdir('Xa', 'R')
+  call writefile(['This is Xb'], 'Xa/Xb.txt', 'D')
+  let olddir = getcwd()
+  let oldargs = argv()
+
+  for tabpage in [v:false, v:true]
+    let msg = tabpage ? 'tabpage-local' : 'window-local'
+
+    exe tabpage ? 'tabnew' : 'botright new'
+    exe tabpage ? 'tcd Xa' : 'lcd Xa'
+    let localdir = getcwd()
+    arglocal
+    $argadd Xb.txt
+    let localargs = argv()
+    exe tabpage ? 'tabprev' : 'wincmd p'
+    call assert_equal(olddir, getcwd(), msg)
+    call assert_equal(oldargs, argv(), msg)
+    mksession! Xtest_mks_localdir.out
+    exe tabpage ? '+tabclose' : '$close'
+    bwipe! Xa/Xb.txt
+
+    source Xtest_mks_localdir.out
+    exe tabpage ? 'tabnext' : 'wincmd b'
+    call assert_equal(localdir, getcwd(), msg)
+    call assert_equal(localargs, argv(), msg)
+    $argument
+    call assert_equal('This is Xb', getline(1), msg)
+
+    bwipe!
+    call assert_equal(olddir, getcwd(), msg)
+    call assert_equal(oldargs, argv(), msg)
+    call delete('Xtest_mks_localdir.out')
+  endfor
+endfunc
+
 func Test_mksession()
   tabnew
   let wrap_save = &wrap
diff --git a/src/version.c b/src/version.c
index 3983083b4..80b5f030a 100644
--- a/src/version.c
+++ b/src/version.c
@@ -709,6 +709,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1450,
 /**/
     1449,
 /**/

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
To view this discussion visit 
https://groups.google.com/d/msgid/vim_dev/E1uP3y4-00Bpjv-MR%40256bit.org.

Raspunde prin e-mail lui