-
Notifications
You must be signed in to change notification settings - Fork 87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Search directory] Prevent duplicate / when fd version >= 8.4.0 #241
Conversation
No idea why the tests failed, but as always I don't find tests interesting 😬 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the readme, just put in parens (when fd version >= [8.4.0](https://github.com/sharkdp/fd/releases/tag/v8.4.0))
functions/_fzf_search_directory.fish
Outdated
@@ -31,7 +31,7 @@ function _fzf_search_directory --description "Search the current directory. Repl | |||
# Then, the user only needs to hit Enter once more to cd into that directory. | |||
if test (count $file_paths_selected) = 1 | |||
set commandline_tokens (commandline --tokenize) | |||
if test "$commandline_tokens" = "$token" -a -d "$file_paths_selected" | |||
if test "$commandline_tokens" = "$token" -a -d "$file_paths_selected" -a (fd --version | string replace --regex --all '[^\d]' '') -lt 840 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you put the fd version check on its own line, line 33, and make it a boolean that you test in the if? more readable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A line break may be simper
oh looks like you'll need to update the test too |
Thanks @kidonng ! |
fd 8.4.0 just released with this (long-awaited?) change:
This is different from how it is handled in fzf.fish, where directories are only appended a slash under strict conditions, so strict it may look like a bug. I'm saying this because I kinda think fzf.fish should have handled it like fd from the beginning.
Now onto the issue. Most programs treat duplicate slashes as one and work as intended, but it certainly does not look good. There are several possible solutions:
Not sure about how to revise the README, maybe just leave it as is, the tip is useful nonetheless. Or maybe drop the "and the only path selected" part.