-
Notifications
You must be signed in to change notification settings - Fork 42
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
FZF_COMPLETION_AUTO_COMMON_PREFIX_PART fails on filenames with spaces in Bash #91
Comments
When I made this functionality, I added a partial completion solely for some kind of compatibility of native behavior. In practice, I never used it myself, so I never ran into a problem. Just wondering why you need it. Basically, it just forces you to press Tab 2 times. Just got used to it? |
It's often that one has files named with a common base followed by a digit, like:
So when I type If I actually wanted to search for a |
The problem comes here
the next call fails intuitive fix partially correct the situation, but there are arises other problems with escaping |
I had faced similar issue and I had reported it for fzf. |
Reported another issue for this repo as well |
I've made a number of changes b8e7133...32fd637 |
@lincheney Thanks for the fix! I've used it for a little while now and saw no more issues. |
@lincheney Thanks. I just tested it and didn't see the issue. |
As a "prolific" user of the The unfixed issue has the same behavior as described above, except that the path typed prior to hitting <tab> contains a relative or absolute path, e.g. Here's a quick one-liner to create the same test files as above under mkdir -p /tmp/fzf && (cd /tmp/fzf; echo > 'bar baz fred.txt'; echo > 'baz qux fred.txt'; echo > 'foo bar baz.txt'; echo > 'foo baz qux.txt'; echo > qux_bar_baz.txt; echo > qux_baz_foo.txt) && ls -al /tmp/fzf Reiterating scenario 2 from the original issue description:
@lincheney I would be grateful if you could revisit the previous fix you've made on this issue, and see if you can have the completion code handle path components in the completion text. In my actual usage, I do a lot of completions of the form: |
First, I'm using the standard setup in my
~/.bashrc
:Let's assume we have these files in a directory:
Here are some scenarios, with the second illustrating the problem:
$ less bar
<tab>This works fine as there's only one match.
$ less bar\ baz\ fred.txt
(cursor after trailing space)$ less foo
<tab>Initial completion to common prefix works fine.
$ less foo\ ba
(cursor right aftera
)$ less foo\ ba
<tab>I'd would expect to see a popup with two choices, but the current partial
command just repeats on a new line after the loading message flashes.
$ less foo\ ba
(cursor still right aftera
)Now delete a character, then hit tab, and repeat...
$ less foo\ b
<tab>Same as above: existing partial command repeats.
$ less foo\ b
(cursor still right afterb
)$ less foo\
<tab> (cursor right after escaped space)Hey, a popup! But I see all filenames instead of
foo*
.If I choose
foo\ bar\ baz.txt
from the list and hit Enter, theentire filename gets appended instead of completed to prefix,
and the completed prompt line is repeated on a separate line.
$ less foo\
$ less foo\ foo\ bar\ baz.txt
(cursor after trailing space)$ less qux
<tab>Initial completion to common prefix works fine.
$ less qux_ba
(cursor right aftera
)$ less qux_ba
<tab>Popup appears with filtered choices, as expected!
╭─────────────────────────────╮ │ > less qux_ba▆ 2/2 │ │ ▶ qux_baz_foo.txt │ │ qux_bar_baz.txt │
If I choose a file from the list and hit Enter, name completion works fine—on the same line.
$ less qux_baz_foo.txt
(cursor after trailing space)$ unset FZF_COMPLETION_AUTO_COMMON_PREFIX_PART
$ less foo
<tab>Without partial common prefix completion, popup appears.
Again, name completion works as expected—on the same line.
$ less foo\ bar\ baz.txt
(cursor after trailing space)The text was updated successfully, but these errors were encountered: