mirror of
https://github.com/airblade/vim-gitgutter.git
synced 2025-11-09 03:53:47 -05:00
Make the 'exceeded max signs' warning less intrusive.
- Only show it once per buffer. - Redraw before echo to avoid the hit-enter prompt. See #259.
This commit is contained in:
@@ -24,7 +24,7 @@ function! gitgutter#process_buffer(bufnr, realtime)
|
|||||||
let modified_lines = gitgutter#diff#process_hunks(gitgutter#hunk#hunks())
|
let modified_lines = gitgutter#diff#process_hunks(gitgutter#hunk#hunks())
|
||||||
|
|
||||||
if len(modified_lines) > g:gitgutter_max_signs
|
if len(modified_lines) > g:gitgutter_max_signs
|
||||||
call gitgutter#utility#warn('exceeded maximum number of signs (configured by g:gitgutter_max_signs).')
|
call gitgutter#utility#warn_once('exceeded maximum number of signs (configured by g:gitgutter_max_signs).', 'max_signs')
|
||||||
call gitgutter#sign#clear_signs()
|
call gitgutter#sign#clear_signs()
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -10,6 +10,16 @@ function! gitgutter#utility#warn(message)
|
|||||||
let v:warningmsg = a:message
|
let v:warningmsg = a:message
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! gitgutter#utility#warn_once(message, key)
|
||||||
|
if empty(getbufvar(s:bufnr, a:key))
|
||||||
|
call setbufvar(s:bufnr, a:key, '1')
|
||||||
|
echohl WarningMsg
|
||||||
|
redraw | echo 'vim-gitgutter: ' . a:message
|
||||||
|
echohl None
|
||||||
|
let v:warningmsg = a:message
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
" Returns truthy when the buffer's file should be processed; and falsey when it shouldn't.
|
" Returns truthy when the buffer's file should be processed; and falsey when it shouldn't.
|
||||||
" This function does not and should not make any system calls.
|
" This function does not and should not make any system calls.
|
||||||
function! gitgutter#utility#is_active()
|
function! gitgutter#utility#is_active()
|
||||||
|
|||||||
Reference in New Issue
Block a user