mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-25 00:57:25 +08:00
commandline --showing-suggestion to ignore single-space autosuggestion
Some checks are pending
make test / macos (push) Waiting to run
make test / ubuntu (push) Waiting to run
make test / ubuntu-32bit-static-pcre2 (push) Waiting to run
make test / ubuntu-asan (push) Waiting to run
Rust checks / rustfmt (push) Waiting to run
Rust checks / clippy (push) Waiting to run
Some checks are pending
make test / macos (push) Waiting to run
make test / ubuntu (push) Waiting to run
make test / ubuntu-32bit-static-pcre2 (push) Waiting to run
make test / ubuntu-asan (push) Waiting to run
Rust checks / rustfmt (push) Waiting to run
Rust checks / clippy (push) Waiting to run
All-whitespace autocompletions are invisible, no matter the cursor shape. We do offer such autosuggestions after typing a command name such as "fish". Since the autosuggestion is invisible it's probably not useful. It also does no harm except when using a binding like bind ctrl-g ' if commandline --showing-suggestion commandline -f accept-autosuggestion else up-or-search end' where typing "fish<ctrl-g>" surprisingly does not perform a history search. Fix this by detecting this specific case. In future we could probably stop showing autosuggestions whenever they only contain whitespace.
This commit is contained in:
parent
ec939fb22f
commit
cd3b6f9124
|
@ -963,7 +963,10 @@ pub fn reader_showing_suggestion(parser: &Parser) -> bool {
|
|||
}
|
||||
if let Some(data) = current_data() {
|
||||
let reader = Reader { parser, data };
|
||||
!reader.autosuggestion.is_empty()
|
||||
let suggestion = &reader.autosuggestion.text;
|
||||
let is_single_space = suggestion.ends_with(L!(" "))
|
||||
&& reader.command_line.text() == suggestion[..suggestion.len() - 1];
|
||||
!suggestion.is_empty() && !is_single_space
|
||||
} else {
|
||||
false
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user