From d9dd360d2aff7d3e1580367692c83fcd3647a439 Mon Sep 17 00:00:00 2001 From: Sean Dewar Date: Mon, 7 Dec 2020 18:35:03 +0000 Subject: vim-patch:8.2.1967: the session file does not restore the alternate file Problem: The session file does not restore the alternate file. Solution: Add ":balt". Works like ":badd" and also sets the buffer as the alternate file. Use it in the session file. (closes vim/vim#7269, closes vim/vim#6714) https://github.com/vim/vim/commit/59d8e56e048eb5d384649284fb35363931fc3697 Include minimal test_buffer.vim from patch 8.2.0243 for Test_balt(). Add entry for :balt to runtime/doc/index.txt from vim/vim#7819. --- src/nvim/ex_session.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/nvim/ex_session.c') diff --git a/src/nvim/ex_session.c b/src/nvim/ex_session.c index 14dac9a126..f6fd6df5ad 100644 --- a/src/nvim/ex_session.c +++ b/src/nvim/ex_session.c @@ -384,6 +384,17 @@ static int put_view( xfree(fname_esc); } + if (wp->w_alt_fnum) { + buf_T *const alt = buflist_findnr(wp->w_alt_fnum); + + // Set the alternate file. + if (alt != NULL && alt->b_fname != NULL && *alt->b_fname != NUL + && (fputs("balt ", fd) < 0 + || ses_fname(fd, alt, flagp, true) == FAIL)) { + return FAIL; + } + } + // // Local mappings and abbreviations. // -- cgit