mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-07-02 00:51:15 -03:00
Expand more when performing history path detection
When adding a command to history, we first expand its arguments to see if any arguments are paths which refer to files. If so, we will only autosuggest that command from history if the files are still valid. For example, if the user runs `rm ./file.txt` then we will remember that `./file.txt` referred to a file, and then only autosuggest that if the file is present again. Prior to this change we only performed simple expansion relative to the working directory. This change extends it to variables and tilde expansion. For example we will now apply the same hinting for `rm ~/file.txt` Fixes #7582
This commit is contained in:
@@ -3241,7 +3241,7 @@ void reader_data_t::handle_readline_command(readline_cmd_t c, readline_loop_stat
|
||||
} else {
|
||||
mode = history_persistence_mode_t::disk;
|
||||
}
|
||||
history->add_pending_with_file_detection(text, vars.get_pwd_slash(), mode);
|
||||
history->add_pending_with_file_detection(text, vars.snapshot(), mode);
|
||||
}
|
||||
|
||||
rls.finished = true;
|
||||
|
||||
Reference in New Issue
Block a user