-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
{q}
isn't escaped properly on Windows
#3789
Comments
Does it also work with (when fzf --ansi --disabled --bind="change:reload:rg --line-number --column --color=always {q} 2>&1" |
@junegunn, you didn't test my use-case properly, I can see the command you ran in the screenshot:
fzf --disabled --preview-window up --preview "rg --line-number --column --color=always -- {q}"
fzf --disabled --preview-window up --preview "rg --line-number --column --color=always -- {q} 2>&1"
fzf --disabled --preview-window up --preview "rg --line-number --column --color=always -- {q} || break" The reason I need to add |
@junegunn, the current escape sequnce also fails when searching for special characters prefixed by fzf --disabled --preview-window up --preview "rg --line-number --column --color=always -- {q}"
|
Thanks for the input. Will check again later, for some reason I can't connect to a Windows EC2 instance. 🤷 |
Thanks for reporting this serious issue. 0.52.1 is a (hurried) attempt to fix the issue. Please test if it helps. I'm sure there are some other issues lurking, but at least it should be safer than what we had in 0.52.0. |
Tysm @junegunn! I have seen some other oddities happening but will have to test this throughly so I can pinpoint the exact issue and whether this is a bug or just different behavior for which fzf-lua will have to adjust. Will report back tomorrow. |
@junegunn, everything seems to be in order at first glance, but I think that Consider the following which attempts to run fzf --ansi --disabled --bind="change:reload:IF {q} NEQ \^"^^\" rg --line-number --column --color=always {q}" The condition works fine in all special characters I tested aside from I believe Line 24 in 6432f00
So that it will later be preceded by Lines 137 to 139 in 6432f00
|
So I guess the problem with In the meantime, maybe you could work around it by using a batch file and not directly writing conditionals in the binding expression? Just guessing. |
I also had no idea
I already have this handled in the lua wrapper this was just something that was popping up in the |
Good to hear that, thanks. |
Checklist
man fzf
)Output of
fzf --version
0.52.0 (bcda25a)
OS
Shell
Problem / Steps to reproduce
Follwing up on #3626, we now have a different issue.
I found the current escaping sequence isn't yet working properly, while the command described in #3626 (basically, "live grep") is working it will only work when
{q}
is the last argument of the command.Consider we want to display
rg
error messages inside fzf, we have to redirect the error stream to stdout by adding2>&1
:fzf --ansi --disabled --bind="change:reload:rg --line-number --column --color=always {q} 2>&1"
Now if we have an open
\
we see the error inside fzf (instead of "Command failed: ... "):But since
{q}
isn't escaped properly if we try to search for a single"
, the command fails:Another use-case where this fails is if we want to silently fail
rg
and never display "Command failed", we could do that by adding|| break
(similar to|| true
on UNIX):fzf --ansi --disabled --bind="change:reload:rg --line-number --column --color=always {q} || break"
Again, if we search for
"
the command will fail:The text was updated successfully, but these errors were encountered: