mirror of
https://github.com/vim-airline/vim-airline.git
synced 2025-07-24 14:35:32 +02:00
plugin: handle sandbox mode gracefully
When the sandbox is active (e.g. while debugging something), certains commands and expressions are not allowed (see :h sandbox) and may cause nasty exceptions to be thrown. So try to catch E48 and handle it gracefully
This commit is contained in:
parent
90c6746311
commit
2cea8346cf
@ -156,7 +156,12 @@ function! airline#update_statusline()
|
||||
" Now create the active statusline
|
||||
let w:airline_active = 1
|
||||
let context = { 'winnr': winnr(), 'active': 1, 'bufnr': winbufnr(winnr()) }
|
||||
call s:invoke_funcrefs(context, g:airline_statusline_funcrefs)
|
||||
try
|
||||
call s:invoke_funcrefs(context, g:airline_statusline_funcrefs)
|
||||
catch /^Vim\%((\a\+)\)\=:E48:/
|
||||
" Catch: Sandbox mode
|
||||
" no-op
|
||||
endtry
|
||||
endfunction
|
||||
|
||||
" Function to be called to make all statuslines inactive
|
||||
@ -186,7 +191,12 @@ function! airline#update_statusline_inactive(range)
|
||||
\ 'left_sep': g:airline_left_alt_sep,
|
||||
\ 'right_sep': g:airline_right_alt_sep }, 'keep')
|
||||
endif
|
||||
call s:invoke_funcrefs(context, g:airline_inactive_funcrefs)
|
||||
try
|
||||
call s:invoke_funcrefs(context, g:airline_inactive_funcrefs)
|
||||
catch /^Vim\%((\a\+)\)\=:E48:/
|
||||
" Catch: Sandbox mode
|
||||
" no-op
|
||||
endtry
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
|
@ -180,7 +180,12 @@ function! airline#util#doautocmd(event)
|
||||
" airline disabled
|
||||
return
|
||||
endif
|
||||
exe printf("silent doautocmd %s User %s", s:nomodeline, a:event)
|
||||
try
|
||||
exe printf("silent doautocmd %s User %s", s:nomodeline, a:event)
|
||||
catch /^Vim\%((\a\+)\)\=:E48:/
|
||||
" Catch: Sandbox mode
|
||||
" no-op
|
||||
endtry
|
||||
endfunction
|
||||
|
||||
function! airline#util#themes(match)
|
||||
|
Loading…
x
Reference in New Issue
Block a user