fish-shell/src
Johannes Altmanninger 14df28382d Work around terminals that echo DCS queries
Some terminals such as conhost and putty cannot parse DCS commands,
and will echo them back.

Work around this by making sure that this echoed text will not
be visible.

Do so by temporarily enabling the alternative screen buffer when
sending DCS queries (in this case only XTGETTCAP).  The alternative
screen buffer feature seems widely supported, and easier to get right
than trying to clear individual lines etc.

The alternative screen may still be visible for a
short time.  Luckily we can use [Synchronized Output](
https://gist.github.com/christianparpart/d8a62cc1ab659194337d73e399004036)
to make sure the screen change is never visible to the user.

Querying support for that is deemed safe since it only requires a
CSI command.

Note that it seems that every terminal that supports Synchronized
Output also parses DCS commands successfully.  This means that we
could get away without the alternative screen buffer in practice.
Not sure yet.

The implementation is slightly more complex than necessary in that it
defines a redundant ImplicitEvent. This is for two reasons: 1. I have
a pending change that wants to use it, so this removes diff noise and
2. we historically have sc/input_common.rs not depend on src/output.rs.
I dont' think any are strong reasons though.
2025-01-08 12:06:28 +01:00
..
bin Don't send kitty kbd protocol probe until ECHO is disabled 2025-01-06 05:51:38 +01:00
builtins refactor: misc cleanup (#10998) 2025-01-04 19:49:44 -06:00
env refactor: misc cleanup (#10998) 2025-01-04 19:49:44 -06:00
fork_exec Signals: Compute signal set once on startup 2024-12-04 20:18:16 +01:00
history Fix/suppress some clippies 2024-11-30 12:21:30 -08:00
tests Use explicit Timeout enum instead of magic constants 2025-01-04 18:40:36 -06:00
universal_notifier Add kqueue-based uvar notifier for BSD (#10674) 2024-08-26 17:10:26 -05:00
widecharwidth Update widecharwidth for Unicode 16 2024-09-24 17:00:13 +02:00
wutil Silence clippy lints 2024-11-24 11:17:34 +01:00
abbrs.rs Replace C++ doc \return with "Return" 2024-05-06 14:59:36 -05:00
ast.rs Sort parser keywords 2024-12-23 08:40:02 +01:00
autoload.rs Replace C++ doc \return with "Return" 2024-05-06 14:59:36 -05:00
color.rs Fix/suppress some clippies 2024-11-30 12:21:30 -08:00
common.rs Remove redundant return value from write_loop() 2024-12-30 10:50:01 +01:00
complete.rs Fix replacing completions with a -foo prefix 2024-12-14 09:31:20 +01:00
curses.rs scrollback-push to query for indn/cuu via XTGETTCAP 2025-01-06 06:24:13 +01:00
editable_line.rs Autosuggestions in multi-line command lines 2025-01-01 17:22:50 +01:00
env_dispatch.rs curses: Just use our hardcoded xterm-256color entry as the fallback 2024-12-14 12:10:34 +01:00
env_universal_common.rs refactor: misc cleanup (#10998) 2025-01-04 19:49:44 -06:00
event.rs refactor: misc cleanup (#10998) 2025-01-04 19:49:44 -06:00
exec.rs Additional cleanup of io buffering 2024-12-27 14:09:07 -08:00
expand.rs Do not add a space after completing inside brace expansion 2024-10-19 22:06:05 +02:00
fallback.rs Add ascii fast path for fish_wcswidth(&wstrw) 2024-11-22 21:35:39 -06:00
fd_monitor.rs Use explicit Timeout enum instead of magic constants 2025-01-04 18:40:36 -06:00
fd_readable_set.rs Use explicit Timeout enum instead of magic constants 2025-01-04 18:40:36 -06:00
fds.rs Remove unnecessary use of errno 2025-01-03 19:34:57 +01:00
flog.rs Temporarily enable history_file debug category by default 2024-10-09 14:51:54 +02:00
function.rs refactor: misc cleanup (#10998) 2025-01-04 19:49:44 -06:00
future.rs Remove backports for 1.67 2024-04-29 22:00:59 +02:00
future_feature_flags.rs Feature flag to prevent executing off buffered keys 2025-01-06 06:24:13 +01:00
global_safety.rs Simplify shared-from-this pattern 2024-03-09 10:09:03 +01:00
highlight.rs refactor: misc cleanup (#10998) 2025-01-04 19:49:44 -06:00
history.rs Silence time_t deprecation 2024-12-14 09:34:52 +01:00
input.rs Feature flag to prevent executing off buffered keys 2025-01-06 06:24:13 +01:00
input_common.rs Work around terminals that echo DCS queries 2025-01-08 12:06:28 +01:00
io.rs Remove as_ptr from IoData 2024-12-27 14:36:55 -08:00
job_group.rs Deduplicate jobs passed to disown builtin 2024-11-14 13:24:55 -06:00
key.rs Add menu and printscreen keys 2025-01-06 05:43:22 +01:00
kill.rs Remove L! from sprintf calls 2024-01-13 08:52:54 +01:00
lib.rs Clean up fish-printf in preparation for publishing 2024-09-21 17:52:11 -07:00
libc.c drop confstr implementation 2025-01-02 11:06:29 +08:00
libc.rs drop confstr implementation 2025-01-02 11:06:29 +08:00
locale.rs Remove some (hopefully) unnecessary clippy and compiler directives 2024-06-23 17:13:14 -07:00
nix.rs Move getrusage wrapper in timer.rs to shared nix wrapper module 2025-01-02 23:40:41 +01:00
null_terminated_array.rs Remove yet more dead code 2024-06-29 18:03:52 -07:00
operation_context.rs Make OperationContext not hold a Parser via Rc 2024-06-23 16:39:39 -07:00
output.rs Replace C++ doc \return with "Return" 2024-05-06 14:59:36 -05:00
pager.rs Try to simplify commandline change hooks 2024-12-30 10:50:38 +01:00
panic.rs Prevent test suite from hanging on panic 2024-11-11 16:45:13 -06:00
parse_constants.rs Rename printf crate to fish-printf 2024-06-09 12:29:09 -07:00
parse_execution.rs refactor: misc cleanup (#10998) 2025-01-04 19:49:44 -06:00
parse_tree.rs Use NonZero types for 1-based line numbers 2024-07-07 20:58:09 -05:00
parse_util.rs refactor: misc cleanup (#10998) 2025-01-04 19:49:44 -06:00
parser.rs Clean up some logic around handling the parser blocks 2024-12-27 16:42:38 -08:00
parser_keywords.rs Sort parser keywords 2024-12-23 08:40:02 +01:00
path.rs Create new base directories with mode 0700 2024-12-28 12:13:48 -08:00
print_help.rs Clean up print_help 2024-11-17 17:03:34 -08:00
proc.rs Temporary workaround for BSD WEXITSTATUS libc bug 2024-12-23 14:34:59 +01:00
re.rs Move fish-rust to project root 2024-01-13 03:58:33 +01:00
reader.rs Work around terminals that echo DCS queries 2025-01-08 12:06:28 +01:00
reader_history_search.rs Replace C++ doc \return with "Return" 2024-05-06 14:59:36 -05:00
redirection.rs Remove yet more dead code 2024-06-29 18:03:52 -07:00
screen.rs scrollback-push to query for indn/cuu via XTGETTCAP 2025-01-06 06:24:13 +01:00
signal.rs refactor: misc cleanup (#10998) 2025-01-04 19:49:44 -06:00
termsize.rs Remove yet more dead code 2024-06-29 18:03:52 -07:00
threads.rs Use explicit Timeout enum instead of magic constants 2025-01-04 18:40:36 -06:00
timer.rs Move getrusage wrapper in timer.rs to shared nix wrapper module 2025-01-02 23:40:41 +01:00
tinyexpr.rs math: Nicer error for non-ascii-lowercase identifiers 2024-09-18 22:27:00 +02:00
tokenizer.rs Refactor some more .unwrap/asserts 2024-11-30 23:11:04 +01:00
topic_monitor.rs Use explicit Timeout enum instead of magic constants 2025-01-04 18:40:36 -06:00
trace.rs Remove parser library_data_pod_t ffi workaround 2024-06-02 20:27:44 -05:00
util.rs Stop using the getrandom feature of the rand crate 2024-10-13 12:39:54 -07:00
wait_handle.rs Use strongly typed Pid for job control 2024-11-14 13:02:03 -06:00
wchar.rs Clean up fish-printf in preparation for publishing 2024-09-21 17:52:11 -07:00
wchar_ext.rs Fix replacing completions with a -foo prefix 2024-12-14 09:31:20 +01:00
wcstringutil.rs Extract function for potentially case-insensitive prefix check 2025-01-01 17:22:50 +01:00
wgetopt.rs Reimplement WGetopter::exchange() using rotate_left 2024-04-17 12:41:16 -07:00
wildcard.rs Disable terminal protocols before cancellable operations 2024-11-24 16:11:57 +01:00