diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-03-31 10:04:12 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-31 10:04:12 +0800 |
commit | b6e3a2dbbb4c408c21dc58723d8dd3d68053f0cb (patch) | |
tree | 2d18fa50a5098abf71c1aa2ea140893e26950db4 /src/nvim/ex_session.c | |
parent | 0d4bd420c19e3a81b494ec1f58cffde53d9b84ea (diff) | |
download | rneovim-b6e3a2dbbb4c408c21dc58723d8dd3d68053f0cb.tar.gz rneovim-b6e3a2dbbb4c408c21dc58723d8dd3d68053f0cb.tar.bz2 rneovim-b6e3a2dbbb4c408c21dc58723d8dd3d68053f0cb.zip |
vim-patch:8.2.4645: 'shortmess' changed when session does not store options (#17908)
Problem: 'shortmess' changed when session does not store options.
Solution: Save and restore 'shortmess' if needed. (James Charti,
closes vim/vim#10037)
https://github.com/vim/vim/commit/fd01280d01c2270a320d8c962d24140a8176a400
Diffstat (limited to 'src/nvim/ex_session.c')
-rw-r--r-- | src/nvim/ex_session.c | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/src/nvim/ex_session.c b/src/nvim/ex_session.c index 39ff75d8c2..1235087500 100644 --- a/src/nvim/ex_session.c +++ b/src/nvim/ex_session.c @@ -589,12 +589,18 @@ static int makeopens(FILE *fd, char_u *dirnow) "if expand('%') == '' && !&modified && line('$') <= 1" " && getline(1) == ''\n" " let s:wipebuf = bufnr('%')\n" - "endif\n" - // Now save the current files, current buffer first. - "set shortmess=aoO\n") < 0) { + "endif\n") < 0) { return FAIL; } + // save 'shortmess' if not storing options + if ((ssop_flags & SSOP_OPTIONS) == 0) { + PUTLINE_FAIL("let s:shortmess_save = &shortmess"); + } + + // Now save the current files, current buffer first. + PUTLINE_FAIL("set shortmess=aoO"); + // Put all buffers into the buffer list. // Do it very early to preserve buffer order after loading session (which // can be disrupted by prior `edit` or `tabedit` calls). @@ -842,15 +848,21 @@ static int makeopens(FILE *fd, char_u *dirnow) return FAIL; } - // Re-apply 'winheight', 'winwidth' and 'shortmess'. - if (fprintf(fd, - "set winheight=%" PRId64 " winwidth=%" PRId64 - " shortmess=%s\n", - (int64_t)p_wh, - (int64_t)p_wiw, - p_shm) < 0) { + // Re-apply 'winheight' and 'winwidth'. + if (fprintf(fd, "set winheight=%" PRId64 " winwidth=%" PRId64 "\n", + (int64_t)p_wh, (int64_t)p_wiw) < 0) { return FAIL; } + + // Restore 'shortmess'. + if (ssop_flags & SSOP_OPTIONS) { + if (fprintf(fd, "set shortmess=%s\n", p_shm) < 0) { + return FAIL; + } + } else { + PUTLINE_FAIL("let &shortmess = s:shortmess_save"); + } + if (tab_firstwin != NULL && tab_firstwin->w_next != NULL) { // Restore 'winminheight' and 'winminwidth'. PUTLINE_FAIL("let &winminheight = s:save_winminheight"); |