mirror of
https://github.com/vim-airline/vim-airline.git
synced 2025-07-25 23:14:50 +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
|
" Now create the active statusline
|
||||||
let w:airline_active = 1
|
let w:airline_active = 1
|
||||||
let context = { 'winnr': winnr(), 'active': 1, 'bufnr': winbufnr(winnr()) }
|
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
|
endfunction
|
||||||
|
|
||||||
" Function to be called to make all statuslines inactive
|
" 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,
|
\ 'left_sep': g:airline_left_alt_sep,
|
||||||
\ 'right_sep': g:airline_right_alt_sep }, 'keep')
|
\ 'right_sep': g:airline_right_alt_sep }, 'keep')
|
||||||
endif
|
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
|
endfor
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
@ -180,7 +180,12 @@ function! airline#util#doautocmd(event)
|
|||||||
" airline disabled
|
" airline disabled
|
||||||
return
|
return
|
||||||
endif
|
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
|
endfunction
|
||||||
|
|
||||||
function! airline#util#themes(match)
|
function! airline#util#themes(match)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user