From ece0850b7393114cac651cf9f43fc2c5e1b1cf50 Mon Sep 17 00:00:00 2001 From: Gustavo Sampaio Date: Mon, 1 Aug 2022 09:13:46 -0300 Subject: fix(session): respect sessionoptions=terminal #19497 fixes #13078 Co-authored-by: Yuta Katayama <8683947+yutkat@users.noreply.github.com> --- src/nvim/ex_session.c | 6 ++++++ src/nvim/options.lua | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/nvim/ex_session.c b/src/nvim/ex_session.c index 6ca6da9cd0..1d670afa6d 100644 --- a/src/nvim/ex_session.c +++ b/src/nvim/ex_session.c @@ -193,6 +193,9 @@ static int ses_do_win(win_T *wp) if (bt_help(wp->w_buffer)) { return ssop_flags & SSOP_HELP; } + if (bt_terminal(wp->w_buffer)) { + return ssop_flags & SSOP_TERMINAL; + } return true; } @@ -407,6 +410,8 @@ static int put_view(FILE *fd, win_T *wp, int add_edit, unsigned *flagp, int curr if ((flagp == &ssop_flags) && alt != NULL && alt->b_fname != NULL && *alt->b_fname != NUL && alt->b_p_bl + // do not set balt if buffer is terminal and "terminal" is not set in options + && !(bt_terminal(alt) && !(ssop_flags & SSOP_TERMINAL)) && (fputs("balt ", fd) < 0 || ses_fname(fd, alt, flagp, true) == FAIL)) { return FAIL; @@ -616,6 +621,7 @@ static int makeopens(FILE *fd, char_u *dirnow) FOR_ALL_BUFFERS(buf) { if (!(only_save_windows && buf->b_nwindows == 0) && !(buf->b_help && !(ssop_flags & SSOP_HELP)) + && !(bt_terminal(buf) && !(ssop_flags & SSOP_TERMINAL)) && buf->b_fname != NULL && buf->b_p_bl) { if (fprintf(fd, "badd +%" PRId64 " ", diff --git a/src/nvim/options.lua b/src/nvim/options.lua index 9e4a6a084c..2f941f5d0c 100644 --- a/src/nvim/options.lua +++ b/src/nvim/options.lua @@ -2063,7 +2063,7 @@ return { type='string', list='onecomma', scope={'global'}, deny_duplicates=true, varname='p_ssop', - defaults={if_true="blank,buffers,curdir,folds,help,tabpages,winsize"} + defaults={if_true="blank,buffers,curdir,folds,help,tabpages,winsize,terminal"} }, { full_name='shada', abbreviation='sd', -- cgit