Skip to content
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] fix preview when base dir contains spaces (patch 3) #161

Merged
merged 1 commit into from
May 15, 2021

Conversation

kidonng
Copy link
Contributor

@kidonng kidonng commented May 12, 2021

There is still, yet another bug, afflicting the search directory feature. To reproduce, set -x fzf_preview_dir_cmd ls and search with a base directory with spaces in its name:

image
image

As it turned out, escaping quotes isn't a good idea either. The correct way to use eval is to quote the code entirely. Single quotes for parameter is used for programs instead.

This is a followup from #137 and #152

@PatrickF1 PatrickF1 changed the title [Search files] fix preview for paths containing spaces (final) [Search files] fix preview for paths containing spaces (try 3) May 12, 2021
@PatrickF1 PatrickF1 changed the title [Search files] fix preview for paths containing spaces (try 3) [Search directory] fix preview for paths containing spaces (try 3) May 12, 2021
@PatrickF1 PatrickF1 changed the title [Search directory] fix preview for paths containing spaces (try 3) [Search directory] fix preview for base dirs containing spaces (patch 3) May 12, 2021
@PatrickF1
Copy link
Owner

Can you explain why this?

As it turned out, escaping quotes isn't a good idea either. The correct way to use eval is to quote the code entirely.

@PatrickF1
Copy link
Owner

@kidonng ^ bump on my question

@kidonng
Copy link
Contributor Author

kidonng commented May 15, 2021

Honestly, I don't know either. Maybe I will search for related docs or experiment a bit and give a better answer later, but I think you can merge it first if you like it.

@PatrickF1 PatrickF1 changed the title [Search directory] fix preview for base dirs containing spaces (patch 3) [Search directory] fix preview when base dir contains spaces (patch 3) May 15, 2021
@PatrickF1 PatrickF1 merged commit b59f1cf into PatrickF1:main May 15, 2021
@kidonng
Copy link
Contributor Author

kidonng commented Jun 21, 2021

Can you explain why this?

As it turned out, escaping quotes isn't a good idea either. The correct way to use eval is to quote the code entirely.

I think the answer is the same as before: we need to quote the path and we need to quote it right. Simply escaping the quotes may looks right but in fact isn't, the eval still sees it unquoted.

@PatrickF1
Copy link
Owner

Simply escaping the quotes may looks right but in fact isn't, the eval still sees it unquoted.

Ah that makes sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants