Prevent infinite loop when running non-async on Windows.

Closes #505.
This commit is contained in:
Andy Stewart
2018-04-11 09:56:43 +01:00
parent 3724e1c207
commit 5481318fc1
2 changed files with 11 additions and 3 deletions

View File

@@ -1,5 +1,5 @@
function! gitgutter#utility#supports_overscore_sign()
if s:windows()
if gitgutter#utility#windows()
return &encoding ==? 'utf-8'
else
return &termencoding ==? &encoding || &termencoding == ''
@@ -161,7 +161,7 @@ function! s:set_path(bufnr, path)
endfunction
function! gitgutter#utility#cd_cmd(bufnr, cmd) abort
let cd = s:unc_path(a:bufnr) ? 'pushd' : (s:windows() ? 'cd /d' : 'cd')
let cd = s:unc_path(a:bufnr) ? 'pushd' : (gitgutter#utility#windows() ? 'cd /d' : 'cd')
return cd.' '.s:dir(a:bufnr).' && '.a:cmd
endfunction
@@ -205,6 +205,6 @@ function! s:strip_trailing_new_line(line) abort
return substitute(a:line, '\n$', '', '')
endfunction
function! s:windows()
function! gitgutter#utility#windows()
return has('win64') || has('win32') || has('win16')
endfunction

View File

@@ -76,6 +76,14 @@ call gitgutter#highlight#define_sign_column_highlight()
call gitgutter#highlight#define_highlights()
call gitgutter#highlight#define_signs()
" Prevent infinite loop where:
" - executing a job in the foreground launches a new window which takes the focus;
" - when the job finishes, focus returns to gvim;
" - the FocusGained event triggers a new job (see below).
if gitgutter#utility#windows() && !gitgutter#async#available()
set noshelltemp
endif
" }}}
" Primary functions {{{