From 1651cd7f2031682e5e54d1f9bab48a0b33ffca07 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Mon, 13 Sep 2021 16:58:42 -0400 Subject: [PATCH] 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. --- autoload/fugitive.vim | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim index e679ec1..a62b096 100644 --- a/autoload/fugitive.vim +++ b/autoload/fugitive.vim @@ -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