summaryrefslogtreecommitdiffstats
path: root/src/session.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-11-07 18:41:10 +0100
committerBram Moolenaar <Bram@vim.org>2020-11-07 18:41:10 +0100
commit59d8e56e048eb5d384649284fb35363931fc3697 (patch)
tree3941971859628440195075acf6104cac9ef43821 /src/session.c
parentcbcd9cbd77acc8cc97c0d44683d96c01d3dd0fa7 (diff)
patch 8.2.1967: the session file does not restore the alternate filev8.2.1967
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 #7269, closes #6714)
Diffstat (limited to 'src/session.c')
-rw-r--r--src/session.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/session.c b/src/session.c
index 44976e8cf4..9731bd3a46 100644
--- a/src/session.c
+++ b/src/session.c
@@ -397,6 +397,19 @@ put_view(
}
}
+ if (wp->w_alt_fnum)
+ {
+ buf_T *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.
if ((*flagp & (SSOP_OPTIONS | SSOP_LOCALOPTIONS))
&& makemap(fd, wp->w_buffer) == FAIL)