chrisant996 / clink-fzf

Fzf integration for Clink
MIT License
77 stars 10 forks source link

Bare relative option adds extra fluff to paths #13

Closed eblis closed 6 months ago

eblis commented 6 months ago

Originally opened in the dirx repo, but was a clink-fzf issue.

If the --bare-relative option is supplied then extra fluff is shown for all the paths, mainly .\ (and/or .\\ if you nest dirx command for preview window).

These are the ALT + C suggestions for clink-fzf repository. image

As you can see all the folders start with .\.

And if you also have the preview window enabled (set FZF_ALT_C_OPTS=--preview-window "right:40%,border-left" --bind "ctrl-/:change-preview-window(right:70%|hidden|)" --preview "dirx -b -s --bare-relative --utf8 --level=3 --icons=always {2..}") then the preview paths start with .\\

I'm not sure if this was happening in 0.9 or it only started happening with 0.10. EDIT: I just checked, it only started happening with 0.10.

chrisant996 commented 6 months ago

Can you please share the dirx command line that was used?

If the command line is dirx --bare-relative . then it's intentional that it's supposed to list a .\ prefix before each path. The behavior in v0.9 was a temporary quick hack to get sort of close to the intended behavior quickly.

My testing of ls and eza on Ubuntu with bash and fzf seemed to indicate that's how other tools do it by default. Since dirx is aiming to match CMD DIR by default, a separate flag --bare-relative is needed to gain that behavior.

I may have missed something, though, so can you share the full command line you're using when running dirx?

  --bare-relative       When listing subdirectories recursively, print paths
                        relative to the specified patterns instead of expanding
                        them to fully qualified paths (implies --bare).
chrisant996 commented 6 months ago

I figured out what you meant.

> blahCtrl-T ended up listing .\ prefix when the FZF_..._COMMAND environment variables are configured to use dirx and include the --bare-relative flag.

That wasn't a dirx issue, it was a clink-fzf issue.

Moving this issue to the corresponding repo.

chrisant996 commented 6 months ago

Fixed in fzf.lua to mimic how fzf works with fish on *nix.

(Which is only possible when using dirx instead of dir, and when adding the --bare-relative flag. The CMD dir command has no way to trim the paths and always prints fully qualified paths, but dirx has a way to mimic the path reporting behavior seen on fzf in *nix.)

eblis commented 6 months ago

I compared it with the way my Linux machine lists folders, where the ./ is not shown/present.

This is how ALT + C lists folders on my Linux Mint machine. image

chrisant996 commented 6 months ago

The fix was published earlier today.

Was an issue in fzf.lua, not DirX.

eblis commented 6 months ago

Thanks, already using it.

Noticed another possible issue with it, will be adding an issue shortly. I'm not sure if it's a clink-fzf issue though, might be a fzf issue.