mirror of
https://github.com/neovim/neovim
synced 2025-07-17 09:41:46 +00:00
vim-patch:9.1.1450: Session has wrong arglist with :tcd and :arglocal (#34430)
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: vim/vim#17503a304e49790
(cherry picked from commit612f8e7c9e
)
This commit is contained in:
committed by
github-actions[bot]
parent
b0ced63e43
commit
d28ad6e03f
@ -525,7 +525,7 @@ void check_arg_idx(win_T *win)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// ":args", ":argslocal" and ":argsglobal".
|
/// ":args", ":arglocal" and ":argglobal".
|
||||||
void ex_args(exarg_T *eap)
|
void ex_args(exarg_T *eap)
|
||||||
{
|
{
|
||||||
if (eap->cmdidx != CMD_args) {
|
if (eap->cmdidx != CMD_args) {
|
||||||
|
@ -323,7 +323,8 @@ static int ses_put_fname(FILE *fd, char *name, unsigned *flagp)
|
|||||||
/// @param add_edit add ":edit" command to view
|
/// @param add_edit add ":edit" command to view
|
||||||
/// @param flagp vop_flags or ssop_flags
|
/// @param flagp vop_flags or ssop_flags
|
||||||
/// @param current_arg_idx current argument index of the window, use -1 if unknown
|
/// @param current_arg_idx current argument index of the window, use -1 if unknown
|
||||||
static int put_view(FILE *fd, win_T *wp, int add_edit, unsigned *flagp, int current_arg_idx)
|
static int put_view(FILE *fd, win_T *wp, tabpage_T *tp, bool add_edit, unsigned *flagp,
|
||||||
|
int current_arg_idx)
|
||||||
{
|
{
|
||||||
int f;
|
int f;
|
||||||
bool did_next = false;
|
bool did_next = false;
|
||||||
@ -339,6 +340,7 @@ static int put_view(FILE *fd, win_T *wp, int add_edit, unsigned *flagp, int curr
|
|||||||
if (ses_arglist(fd, "arglocal", &wp->w_alist->al_ga,
|
if (ses_arglist(fd, "arglocal", &wp->w_alist->al_ga,
|
||||||
flagp == &vop_flags
|
flagp == &vop_flags
|
||||||
|| !(*flagp & kOptSsopFlagCurdir)
|
|| !(*flagp & kOptSsopFlagCurdir)
|
||||||
|
|| tp->tp_localdir != NULL
|
||||||
|| wp->w_localdir != NULL, flagp) == FAIL) {
|
|| wp->w_localdir != NULL, flagp) == FAIL) {
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
@ -835,7 +837,7 @@ static int makeopens(FILE *fd, char *dirnow)
|
|||||||
if (!ses_do_win(wp)) {
|
if (!ses_do_win(wp)) {
|
||||||
continue;
|
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)
|
||||||
== FAIL) {
|
== FAIL) {
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
@ -1053,7 +1055,7 @@ void ex_mkrc(exarg_T *eap)
|
|||||||
}
|
}
|
||||||
xfree(dirnow);
|
xfree(dirnow);
|
||||||
} else {
|
} else {
|
||||||
failed |= (put_view(fd, curwin, !using_vdir, flagp, -1) == FAIL);
|
failed |= (put_view(fd, curwin, curtab, !using_vdir, flagp, -1) == FAIL);
|
||||||
}
|
}
|
||||||
if (fprintf(fd,
|
if (fprintf(fd,
|
||||||
"%s",
|
"%s",
|
||||||
|
@ -31,6 +31,42 @@ func Test__mksession_arglocal()
|
|||||||
call delete('Xtest_mks.out')
|
call delete('Xtest_mks.out')
|
||||||
endfunc
|
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()
|
func Test_mksession()
|
||||||
tabnew
|
tabnew
|
||||||
let wrap_save = &wrap
|
let wrap_save = &wrap
|
||||||
|
Reference in New Issue
Block a user