lincheney / fzf-tab-completion

Tab completion using fzf
GNU General Public License v3.0
623 stars 40 forks source link

Completion of non-existing files expands to a space (bash) #59

Closed marcopaganini closed 1 year ago

marcopaganini commented 1 year ago

Completion of non-existing files expands to a space (bash)

How to reproduce

First create a test directory with a single file (aaa):

mkdir /tmp/test
cd /tmp/test
touch aaa

Then try the following:

cd /tmp/test
echo a<TAB>

The "a" string correctly expands to "aaa", which is an existing file on the current directory.

Now try:

cd /tmp/test
echo b<TAB>

What is expected

There are no files starting with "b" under /tmp/test. The expected behavior is to see a brief "Loading matches..." message, with the cursor returning to its original position (right after the "b" letter).

What actually happens

The already typed "b" letter gets replaced by a single space. This makes it difficult because whatever prefix was already typed before the <TAB> will be replaced by one space.

I ran a git bisect on my local repo. It appears that this bug was introduced by commit 6464769 (bash: convert newlines to fix multi selection).

Workaround

Revert the local repo to the previous commit (git reset 81c99f6 --hard), but doing this will naturally prevent new bugfixes and features from being effected.