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 From add0cf9a42a5122d74d0b89301802ba10bef802b Mon Sep 17 00:00:00 2001 From: Sean Dewar Date: Mon, 7 Dec 2020 20:10:58 +0000 Subject: vim-patch:8.2.2058: using mkview/loadview changes the jumplist Problem: Using mkview/loadview changes the jumplist. Solution: Use ":keepjumps". Don't let ":badd" or ":balt" change the jumplist. (closes vim/vim#7371) https://github.com/vim/vim/commit/3482be6a33c3a00fe1e8e604310ad3034f593045 Definition for BufWinEnter autocmd in Test_mkview_loadview_jumplist() was moved down a few lines until after the views are written, as in Nvim, :loadview throws if the view file can't be opened. --- src/nvim/ex_session.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/nvim/ex_session.c') diff --git a/src/nvim/ex_session.c b/src/nvim/ex_session.c index f6fd6df5ad..4915070e91 100644 --- a/src/nvim/ex_session.c +++ b/src/nvim/ex_session.c @@ -449,9 +449,9 @@ static int put_view( "let s:l = %" PRId64 " - ((%" PRId64 " * winheight(0) + %" PRId64 ") / %" PRId64 ")\n" "if s:l < 1 | let s:l = 1 | endif\n" - "exe s:l\n" + "keepjumps exe s:l\n" "normal! zt\n" - "%" PRId64 "\n", + "keepjumps %" PRId64 "\n", (int64_t)wp->w_cursor.lnum, (int64_t)(wp->w_cursor.lnum - wp->w_topline), (int64_t)(wp->w_height_inner / 2), -- cgit From 4bc82a59b6fc3927ce20c7cadb080ed1c9d6fce8 Mon Sep 17 00:00:00 2001 From: Sean Dewar Date: Thu, 11 Feb 2021 03:42:15 +0000 Subject: vim-patch:8.2.2467: script generated by :mkview changes alternate file Problem: Script generated by :mkview changes alternate file. Solution: Only write :balt in the session file. (Harish Rajagopal, closes vim/vim#7779) https://github.com/vim/vim/commit/139348f3e8370826a1ceb10c73f7c7bb586f8125 --- src/nvim/ex_session.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/nvim/ex_session.c') diff --git a/src/nvim/ex_session.c b/src/nvim/ex_session.c index 4915070e91..63789b3981 100644 --- a/src/nvim/ex_session.c +++ b/src/nvim/ex_session.c @@ -388,7 +388,8 @@ static int put_view( 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 + if ((flagp == &ssop_flags) && alt != NULL && alt->b_fname != NULL + && *alt->b_fname != NUL && (fputs("balt ", fd) < 0 || ses_fname(fd, alt, flagp, true) == FAIL)) { return FAIL; -- cgit