mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-22 20:31:15 -03:00
Fix autosuggestion dropping too many keyword tokens
This commit is contained in:
@@ -663,7 +663,11 @@ pub fn perform_for_commandline(&mut self, cmdline: WString) {
|
||||
|
||||
// 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.
|
||||
|
||||
Reference in New Issue
Block a user