mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-27 05:13:10 +00:00
commandline --showing-suggestion to ignore single-space autosuggestion
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
1 changed files with 4 additions and 1 deletions
|
@ -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 a new issue