Extract helper to determine PTY availability

I constantly have to ask about this to troubleshoot bug reports, so make
it easier to determine.

Also rename g:fugitive_pty to make it clearer that it's not a preference
but a debugging tool.
This commit is contained in:
Tim Pope
2021-09-13 16:58:42 -04:00
parent 630ecc8c3a
commit 1651cd7f20

View File

@@ -3433,6 +3433,11 @@ augroup fugitive_job
\ endfor
augroup END
function! fugitive#CanPty() abort
return get(g:, 'fugitive_pty_debug_override',
\ has('unix') && !has('win32unix') && (has('patch-8.0.0744') || has('nvim')) && fugitive#GitVersion() !~# '\.windows\>')
endfunction
function! fugitive#PagerFor(argv, ...) abort
let args = a:argv
if empty(args)
@@ -3609,7 +3614,7 @@ function! fugitive#Command(line1, line2, range, bang, mods, arg) abort
endif
if s:run_jobs
call extend(env, {'COLUMNS': '' . (&columns - 1)}, 'keep')
let state.pty = allow_pty && get(g:, 'fugitive_pty', has('unix') && !has('win32unix') && (has('patch-8.0.0744') || has('nvim')) && fugitive#GitVersion() !~# '\.windows\>')
let state.pty = allow_pty && fugitive#CanPty()
if !state.pty
let args = s:AskPassArgs(dir) + args
endif