fish-shell icon indicating copy to clipboard operation
fish-shell copied to clipboard

Bug: Fuzzy tab-completion fails on a file inside a directory with parentheses

Open cstyles opened this issue 2 years ago • 3 comments

fish version: 3.6.1 OS: macOS & Arch Linux Bug occurs without customizations? Yes

Steps to reproduce:

$ mkdir mydir\(parens\)
$ touch mydir\(parens\)/stuff.txt
$ cat mydir\(parens\)/<TAB> # this fills in "stuff.txt" as expected
$ cat mydir\(parens\)/s<TAB> # same here
$ cat mydir\(parens\)/txt<TAB> # this does nothing :(
$ cat 'mydir(parens)/'txt<TAB> # same here

cstyles avatar Jun 17 '23 23:06 cstyles

I'm not sure if this is the same bug or not but fuzzy completion also fails if the directory contains a wildcard:

$ mkdir mydir
$ touch mydir/stuff.txt
$ cat mydir/txt<TAB> # this fills in "stuff.txt" as expected
$ cat mydi*/<TAB> # same here
$ cat mydi*/txt<TAB> # this does nothing :(

cstyles avatar Jun 25 '23 02:06 cstyles

Interestingly, in addition to not completing the filename, the line also doesn't "flash" like it does for other failed completions. For example:

$ mkdir mydir
$ touch mydir/stuff.txt
$ cat mydir/nope<TAB> # this flashes the command line
$ cat mydi*/nope<TAB> # same here
$ cat mydi*/txt<TAB> # this doesn't complete the filename AND doesn't flash

It's as if fish is able to find the file but doesn't complete it.

cstyles avatar Jun 25 '23 02:06 cstyles

Nice find, probably it's because REPLACE_UNCLEAN = L"$*?({})"; is too crude. We should instead use something like parse_util_locate_cmdsubst_range to determine whether a string token contains command substitutions

krobelus avatar Jun 25 '23 05:06 krobelus