Merge #11261 from janlazo/vim-8.1.2185

vim-patch:8.1.{2185,2188,2190,2197}
This commit is contained in:
Justin M. Keyes
2019-10-22 21:09:45 -07:00
committed by GitHub
4 changed files with 32 additions and 6 deletions

View File

@@ -6070,9 +6070,11 @@ static bool before_quit_autocmds(win_T *wp, bool quit_all, int forceit)
if (quit_all if (quit_all
|| (check_more(false, forceit) == OK && only_one_window())) { || (check_more(false, forceit) == OK && only_one_window())) {
apply_autocmds(EVENT_EXITPRE, NULL, NULL, false, curbuf); apply_autocmds(EVENT_EXITPRE, NULL, NULL, false, curbuf);
// Refuse to quit when locked or when the buffer in the last window is // Refuse to quit when locked or when the window was closed or the
// being closed (can only happen in autocommands). // buffer in the last window is being closed (can only happen in
if (curbuf_locked() // autocommands).
if (!win_valid(wp)
|| curbuf_locked()
|| (curbuf->b_nwindows == 1 && curbuf->b_locked > 0)) { || (curbuf->b_nwindows == 1 && curbuf->b_locked > 0)) {
return true; return true;
} }

View File

@@ -27,6 +27,8 @@
#define WILD_ESCAPE 0x80 #define WILD_ESCAPE 0x80
#define WILD_ICASE 0x100 #define WILD_ICASE 0x100
#define WILD_ALLLINKS 0x200 #define WILD_ALLLINKS 0x200
#define WILD_IGNORE_COMPLETESLASH 0x400
#define WILD_NOERROR 0x800 // sets EW_NOERROR
/// Present history tables /// Present history tables
typedef enum { typedef enum {

View File

@@ -40,6 +40,7 @@ func Test_exiting()
endif endif
call delete('Xtestout') call delete('Xtestout')
" ExitPre autocommand splits the window, so that it's no longer the last one.
let after =<< trim [CODE] let after =<< trim [CODE]
au QuitPre * call writefile(["QuitPre"], "Xtestout", "a") au QuitPre * call writefile(["QuitPre"], "Xtestout", "a")
au ExitPre * call writefile(["ExitPre"], "Xtestout", "a") au ExitPre * call writefile(["ExitPre"], "Xtestout", "a")
@@ -58,4 +59,25 @@ func Test_exiting()
\ readfile('Xtestout')) \ readfile('Xtestout'))
endif endif
call delete('Xtestout') call delete('Xtestout')
" ExitPre autocommand splits and closes the window, so that there is still
" one window but it's a different one.
let after =<< trim [CODE]
au QuitPre * call writefile(["QuitPre"], "Xtestout", "a")
au ExitPre * call writefile(["ExitPre"], "Xtestout", "a")
augroup nasty
au ExitPre * split | only
augroup END
quit
augroup nasty
au! ExitPre
augroup END
quit
[CODE]
if RunVim([], after, '')
call assert_equal(['QuitPre', 'ExitPre', 'QuitPre', 'ExitPre'],
\ readfile('Xtestout'))
endif
call delete('Xtestout')
endfunc endfunc

View File

@@ -502,9 +502,7 @@ func Test_syntax_c()
endif endif
call writefile([ call writefile([
\ '/* comment line at the top */', \ '/* comment line at the top */',
\ ' int', \ 'int main(int argc, char **argv) { // another comment',
\ 'main(int argc, char **argv)// another comment',
\ '{',
\ '#if 0', \ '#if 0',
\ ' int not_used;', \ ' int not_used;',
\ '#else', \ '#else',
@@ -519,6 +517,7 @@ func Test_syntax_c()
\ ' for (int i = 0; i < count; ++i) {', \ ' for (int i = 0; i < count; ++i) {',
\ ' break;', \ ' break;',
\ ' }', \ ' }',
\ " Note: asdf",
\ '}', \ '}',
\ ], 'Xtest.c') \ ], 'Xtest.c')
@@ -527,6 +526,7 @@ func Test_syntax_c()
let $COLORFGBG = '15;0' let $COLORFGBG = '15;0'
let buf = RunVimInTerminal('Xtest.c', {}) let buf = RunVimInTerminal('Xtest.c', {})
call term_sendkeys(buf, ":syn keyword Search Note\r")
call VerifyScreenDump(buf, 'Test_syntax_c_01', {}) call VerifyScreenDump(buf, 'Test_syntax_c_01', {})
call StopVimInTerminal(buf) call StopVimInTerminal(buf)