mirror of
https://github.com/airblade/vim-gitgutter.git
synced 2025-11-08 11:33:48 -05:00
Ensure inactive tabs are force-updated after FocusGained.
On FocusGained the current tab is force-updated. If there are any other tabs, we want to make sure they are also force-updated when the user next switches to them. To do this we set a flag which is read and cleared on TabEnter. See #525.
This commit is contained in:
@@ -173,6 +173,16 @@ nnoremap <silent> <Plug>GitGutterPreviewHunk :GitGutterPreviewHunk<CR>
|
|||||||
|
|
||||||
" }}}
|
" }}}
|
||||||
|
|
||||||
|
function! s:flag_inactive_tabs()
|
||||||
|
let active_tab = tabpagenr()
|
||||||
|
let last_tab = tabpagenr('$')
|
||||||
|
for i in range(1, last_tab)
|
||||||
|
if i != active_tab
|
||||||
|
call settabvar(i, 'gitgutter_force', 1)
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
endfunction
|
||||||
|
|
||||||
" Autocommands {{{
|
" Autocommands {{{
|
||||||
|
|
||||||
augroup gitgutter
|
augroup gitgutter
|
||||||
@@ -183,7 +193,12 @@ augroup gitgutter
|
|||||||
autocmd BufEnter *
|
autocmd BufEnter *
|
||||||
\ if exists('t:gitgutter_didtabenter') && t:gitgutter_didtabenter |
|
\ if exists('t:gitgutter_didtabenter') && t:gitgutter_didtabenter |
|
||||||
\ let t:gitgutter_didtabenter = 0 |
|
\ let t:gitgutter_didtabenter = 0 |
|
||||||
\ call gitgutter#all(!g:gitgutter_terminal_reports_focus) |
|
\ let force = !g:gitgutter_terminal_reports_focus |
|
||||||
|
\ if exists('t:gitgutter_force') && t:gitgutter_force |
|
||||||
|
\ let t:gitgutter_force = 0 |
|
||||||
|
\ let force = 1 |
|
||||||
|
\ endif |
|
||||||
|
\ call gitgutter#all(force) |
|
||||||
\ else |
|
\ else |
|
||||||
\ call gitgutter#init_buffer(bufnr('')) |
|
\ call gitgutter#init_buffer(bufnr('')) |
|
||||||
\ call gitgutter#process_buffer(bufnr(''), !g:gitgutter_terminal_reports_focus) |
|
\ call gitgutter#process_buffer(bufnr(''), !g:gitgutter_terminal_reports_focus) |
|
||||||
@@ -197,7 +212,7 @@ augroup gitgutter
|
|||||||
" vim -o file1 file2
|
" vim -o file1 file2
|
||||||
autocmd VimEnter * if winnr() != winnr('$') | call gitgutter#all(0) | endif
|
autocmd VimEnter * if winnr() != winnr('$') | call gitgutter#all(0) | endif
|
||||||
|
|
||||||
autocmd FocusGained * call gitgutter#all(1)
|
autocmd FocusGained * call gitgutter#all(1) | call s:flag_inactive_tabs()
|
||||||
|
|
||||||
autocmd ColorScheme * call gitgutter#highlight#define_sign_column_highlight() | call gitgutter#highlight#define_highlights()
|
autocmd ColorScheme * call gitgutter#highlight#define_sign_column_highlight() | call gitgutter#highlight#define_highlights()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user