mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:8.2.4980: when 'shortmess' contains 'A' loading session may still warn (#18636)
Problem: When 'shortmess' contains 'A' loading a session may still warn for
an existing swap file. (Melker Österberg)
Solution: Keep the 'A' flag to 'shortmess' in the session file.
(closes vim/vim#10443)
aaadb5b6f7
Use readfile() with "B" flag in test as readblob() needs patch 8.2.2343.
This commit is contained in:
parent
69853a622a
commit
eb0aa8bb0e
@ -598,9 +598,14 @@ static int makeopens(FILE *fd, char_u *dirnow)
|
||||
PUTLINE_FAIL("let s:shortmess_save = &shortmess");
|
||||
}
|
||||
|
||||
// Now save the current files, current buffer first.
|
||||
PUTLINE_FAIL("set shortmess=aoO");
|
||||
// set 'shortmess' for the following. Add the 'A' flag if it was there
|
||||
PUTLINE_FAIL("if &shortmess =~ 'A'");
|
||||
PUTLINE_FAIL(" set shortmess=aoOA");
|
||||
PUTLINE_FAIL("else");
|
||||
PUTLINE_FAIL(" set shortmess=aoO");
|
||||
PUTLINE_FAIL("endif");
|
||||
|
||||
// Now save the current files, current buffer first.
|
||||
// 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).
|
||||
|
@ -838,6 +838,30 @@ func Test_mksession_shortmess()
|
||||
set sessionoptions&
|
||||
endfunc
|
||||
|
||||
" Test that when Vim loading session has 'A' in 'shortmess' it does not
|
||||
" complain about an existing swapfile.
|
||||
func Test_mksession_shortmess_with_A()
|
||||
edit Xtestfile
|
||||
write
|
||||
let fname = swapname('%')
|
||||
" readblob() needs patch 8.2.2343
|
||||
" let cont = readblob(fname)
|
||||
let cont = readfile(fname, 'B')
|
||||
set sessionoptions-=options
|
||||
mksession Xtestsession
|
||||
bwipe!
|
||||
|
||||
" Recreate the swap file to pretend the file is being edited
|
||||
call writefile(cont, fname)
|
||||
set shortmess+=A
|
||||
source Xtestsession
|
||||
|
||||
set shortmess&
|
||||
set sessionoptions&
|
||||
call delete('Xtestsession')
|
||||
call delete(fname)
|
||||
endfunc
|
||||
|
||||
" Test for mksession with 'compatible' option
|
||||
func Test_mksession_compatible()
|
||||
throw 'skipped: Nvim does not support "compatible" option'
|
||||
|
Loading…
Reference in New Issue
Block a user