diff options
| author | Kyle <50718101+kylesower@users.noreply.github.com> | 2026-04-24 13:45:20 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-04-24 14:45:20 -0400 |
| commit | 66149ca6681102ff758b516984a1ccfe2ce0d974 (patch) | |
| tree | dda7144c33a7cc261e453a40ce35711f53b50818 /src | |
| parent | 393f687503a319a6f521e8335b4dd8030e3ea67b (diff) | |
feat(tui): restore 'ttyfast' to control tty requests #38699
Problem:
When running nvim on a remote machine over SSH, if there is high ping,
then bg detection may not complete in time. This results in a warning
every time nvim is started. #38648
Solution:
Restore 'ttyfast' option and allow it to control whether or not bg
detection is performed. Because this is during startup and before any
user config or commands, we use the environment variable
`NVIM_NOTTYFAST` to allow disabling `ttyfast` during initialization.
Diffstat (limited to 'src')
| -rw-r--r-- | src/nvim/option.c | 6 | ||||
| -rw-r--r-- | src/nvim/option_vars.h | 1 | ||||
| -rw-r--r-- | src/nvim/options.lua | 12 |
3 files changed, 17 insertions, 2 deletions
diff --git a/src/nvim/option.c b/src/nvim/option.c index a392412d53..c23a6855aa 100644 --- a/src/nvim/option.c +++ b/src/nvim/option.c @@ -407,6 +407,12 @@ void set_init_1(bool clean_arg) // Expand environment variables and things like "~" for the defaults. set_init_expand_env(); + // Allow disabling ttyfast during startup to disable features such as + // automatic background detection over slow connections. + if (os_env_exists("NVIM_NOTTYFAST", false)) { + set_option_value_give_err(kOptTtyfast, BOOLEAN_OPTVAL(false), 0); + } + save_file_ff(curbuf); // Buffer is unchanged // Detect use of mlterm. diff --git a/src/nvim/option_vars.h b/src/nvim/option_vars.h index c57020b553..226f4ad242 100644 --- a/src/nvim/option_vars.h +++ b/src/nvim/option_vars.h @@ -553,6 +553,7 @@ EXTERN char *p_tsr; ///< 'thesaurus' EXTERN int p_tgc; ///< 'termguicolors' EXTERN int p_ttimeout; ///< 'ttimeout' EXTERN OptInt p_ttm; ///< 'ttimeoutlen' +EXTERN int p_tf; ///< 'ttyfast' EXTERN char *p_udir; ///< 'undodir' EXTERN int p_udf; ///< 'undofile' EXTERN OptInt p_ul; ///< 'undolevels' diff --git a/src/nvim/options.lua b/src/nvim/options.lua index 3ab60f0af9..9192a1ee51 100644 --- a/src/nvim/options.lua +++ b/src/nvim/options.lua @@ -9777,12 +9777,20 @@ local options = { { abbreviation = 'tf', defaults = true, + desc = [=[ + Assume that the underlying terminal can respond quickly to queries + required by features such as 'background' detection. + + Nvim issues terminal queries before reading the user's |config| file, + so disabling this option there will not work. Set $NVIM_NOTTYFAST + before starting Nvim to disable terminal queries. + ]=], full_name = 'ttyfast', no_mkrc = true, scope = { 'global' }, - short_desc = N_('Deprecated'), + short_desc = N_('assume terminal responds quickly, enabling more features'), type = 'boolean', - immutable = true, + varname = 'p_tf', }, { abbreviation = 'udir', |
