Feature flag for eventually disabling terminal workarounds

We've removed several terminal-specific workarounds but also added
some recently.  Most of the non-Apple issues have been reported
upstream.  Many of our workarounds were only meant to be temporary.
Some workarounds are unreliable and some can cause introduce other
problems.

Add a feature flag we can use later to let users turn off workarounds.

This doesn't disable anything yet, mostly because because despite being
off-by-default, this might surprise people who use "fish_features=all".
The fix would be "fish_features=all,no-omit-term-workarounds".
So we'd want a high degree of confidence.

For now we'll use this only with the next commit.

Closes #11819
This commit is contained in:
Johannes Altmanninger
2025-09-23 12:57:06 +02:00
parent 7e86e07fb0
commit 9165251a0b
5 changed files with 21 additions and 10 deletions

View File

@@ -1,4 +1,4 @@
fish ?.?.? (released ???)
fish 4.3.0 (released ???)
=========================
Notable improvements and fixes
@@ -11,6 +11,10 @@ Interactive improvements
------------------------
- When typing immediately after starting fish, the first prompt is now rendered correctly.
Improved terminal support
-------------------------
- New :ref:`feature flag <featureflags>` ``omit-term-workarounds`` can be turned on to prevent fish from trying to work around incompatible terminals.
For distributors and developers
-------------------------------
- ``fish_key_reader`` and ``fish_indent`` are now hardlinks to ``fish``.

View File

@@ -2027,6 +2027,7 @@ You can see the current list of features via ``status features``::
mark-prompt on 4.0 write OSC 133 prompt markers to the terminal
ignore-terminfo on 4.1 do not look up $TERM in terminfo database
query-term on 4.1 query the TTY to enable extra functionality
omit-term-workarounds off 4.3 skip workarounds for incompatible terminals
Here is what they mean:
@@ -2041,6 +2042,7 @@ Here is what they mean:
- ``query-term`` allows fish to query the terminal by writing escape sequences and reading the terminal's response.
This enables features such as :ref:`scrolling <term-compat-cursor-position-report>`.
If you use an incompatible terminal, you can -- for the time being -- work around it by running (once) ``set -Ua fish_features no-query-term``.
- ``omit-term-workarounds`` prevents fish from trying to work around incompatible terminals.
These changes are introduced off by default. They can be enabled on a per session basis::

View File

@@ -36,6 +36,9 @@ pub enum FeatureFlag {
/// Whether we are allowed to query the TTY for extra information.
query_term,
/// Do not try to work around incompatible terminal.
omit_term_workarounds,
}
struct Features {
@@ -140,6 +143,14 @@ pub struct FeatureMetadata {
default_value: true,
read_only: false,
},
FeatureMetadata {
flag: FeatureFlag::omit_term_workarounds,
name: L!("omit-term-workarounds"),
groups: L!("4.3"),
description: L!("skip workarounds for incompatible terminals"),
default_value: false,
read_only: false,
},
];
thread_local!(
@@ -204,6 +215,7 @@ const fn new() -> Self {
AtomicBool::new(METADATA[6].default_value),
AtomicBool::new(METADATA[7].default_value),
AtomicBool::new(METADATA[8].default_value),
AtomicBool::new(METADATA[9].default_value),
],
}
}

View File

@@ -75,8 +75,7 @@
use crate::fd_readable_set::poll_fd_readable;
use crate::fds::{AutoCloseFd, make_fd_blocking, wopen_cloexec};
use crate::flog::{FLOG, FLOGF};
use crate::future_feature_flags;
use crate::future_feature_flags::FeatureFlag;
use crate::future_feature_flags::{self, FeatureFlag};
use crate::global_safety::RelaxedAtomicBool;
use crate::highlight::{
HighlightRole, HighlightSpec, autosuggest_validate_from_history, highlight_shell,

View File

@@ -55,16 +55,10 @@ eval test_function
#CHECK: test_function
# Future Feature Flags
status features
status features | head -n3
#CHECK: stderr-nocaret on 3.0 ^ no longer redirects stderr (historical, can no longer be changed)
#CHECK: qmark-noglob on 3.0 ? no longer globs
#CHECK: regex-easyesc on 3.1 string replace -r needs fewer \'s
#CHECK: ampersand-nobg-in-token on 3.4 & only backgrounds if followed by a separator
#CHECK: remove-percent-self off 4.0 %self is no longer expanded (use $fish_pid)
#CHECK: test-require-arg off 4.0 builtin test requires an argument
#CHECK: mark-prompt on 4.0 write OSC 133 prompt markers to the terminal
#CHECK: ignore-terminfo on 4.1 do not look up $TERM in terminfo database
#CHECK: query-term on 4.1 query the TTY to enable extra functionality
status test-feature stderr-nocaret
echo $status
#CHECK: 0