mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-01-19 20:22:45 +08:00
Fix autosuggestion dropping too many keyword tokens
This commit is contained in:
parent
6569943cb8
commit
4e37dc29dc
|
@ -663,7 +663,11 @@ impl<'ctx> Completer<'ctx> {
|
|||
|
||||
// Hack: fix autosuggestion by removing prefixing "and"s #6249.
|
||||
if is_autosuggest {
|
||||
tokens.retain(|token| !parser_keywords_is_subcommand(token.get_source(&cmdline)));
|
||||
let prefixed_supercommand_count = tokens
|
||||
.iter()
|
||||
.take_while(|token| parser_keywords_is_subcommand(token.get_source(&cmdline)))
|
||||
.count();
|
||||
tokens.drain(..prefixed_supercommand_count);
|
||||
}
|
||||
|
||||
// Consume variable assignments in tokens strictly before the cursor.
|
||||
|
|
Loading…
Reference in New Issue
Block a user