Fish history file path detection is broken for path prefixed with
Thank you for this project, I have been using fish for years and I love it. I looked at the issues but could not find one like this.
How to reproduce
When I looked at my
I do not know if it is really an issue or not, but it explain a few questions that I had in the past where I noticed that the autocomplete was inconsistent, and couldn't really understand why.
The text was updated successfully, but these errors were encountered:
After looking at the code, it seems that the function that decide if a path should be added is path_is_valid, and that it is not performing tilde expansion.
I spend a bit of time trying to add expand_tilde to
I see 3 options:
Hi, thanks for the detailed write-up.
This issue also applies to paths with variables, like in
It seems that fish sets HOME if it doesn't exist - of course that doesn't solve the problem for other variables.
I'm not yet sure what is the best solution. We could copy relevant variables. However, it's probably simpler to capture a reference to the environment, and use our
Ok, I'll try to have a look at passing by reference + use a mutex. in the end it might enable arbitrary variable expansion, which should be even more consistent.
If it doesn't work there is already a special getter for
I'll experiment a bit if that's alright.
Sounds good - probably you can pass an entire
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 remeber 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 fish-shell#7582