1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-02-03 01:40:05 +08:00

fix(E5601): close all notify windows on QuitPre

If the current windows is the last one, always get
E5601: Cannot close window, only floating window would remain
This commit is contained in:
wsdjeg 2022-04-10 14:49:58 +08:00
parent f28b8462ff
commit 88eb4db751
2 changed files with 16 additions and 1 deletions

View File

@ -118,7 +118,9 @@ function! s:self.close(...) abort
noautocmd call self.__floating.win_close(self.border.winid, v:true) noautocmd call self.__floating.win_close(self.border.winid, v:true)
noautocmd call self.__floating.win_close(self.winid, v:true) noautocmd call self.__floating.win_close(self.winid, v:true)
endif endif
call remove(s:notifications, self.hashkey) if has_key(s:notifications, self.hashkey)
call remove(s:notifications, self.hashkey)
endif
let self.notification_width = 1 let self.notification_width = 1
endif endif
for hashkey in keys(s:notifications) for hashkey in keys(s:notifications)
@ -126,6 +128,18 @@ function! s:self.close(...) abort
endfor endfor
endfunction endfunction
function! s:self.close_all() abort
let self.message = []
if self.win_is_open()
noautocmd call self.__floating.win_close(self.border.winid, v:true)
noautocmd call self.__floating.win_close(self.winid, v:true)
endif
if has_key(s:notifications, self.hashkey)
call remove(s:notifications, self.hashkey)
endif
let self.notification_width = 1
endfunction
function! s:self.notify(msg, ...) abort function! s:self.notify(msg, ...) abort
call add(self.message, a:msg) call add(self.message, a:msg)
let self.notification_color = get(a:000, 0, 'Normal') let self.notification_color = get(a:000, 0, 'Normal')

View File

@ -100,6 +100,7 @@ function! SpaceVim#layers#lang#vim#config() abort
autocmd! autocmd!
autocmd BufWritePost *.vim call s:generate_doc() autocmd BufWritePost *.vim call s:generate_doc()
autocmd FileType vim set comments=sO:\"\ -,mO:\"\ \ ,eO:\"\",:\" autocmd FileType vim set comments=sO:\"\ -,mO:\"\ \ ,eO:\"\",:\"
autocmd QuitPre * call s:NOTI.close_all()
augroup END augroup END
endif endif
" if the lsp layer is enabled, we should disable default linter " if the lsp layer is enabled, we should disable default linter