rc icon indicating copy to clipboard operation
rc copied to clipboard

Command completion often skips files in the current directory when you use './cm<tab>'

Open siebenmann opened this issue 6 years ago • 3 comments

If you build the latest git version with --with-edit=readline, you get command completion and the command completion handles 'dir/cmd' in the same way that rc's $path does, which is great. However, it appears to mishandle completion for './cm', at least if . is not on your $path. You don't get completions for things in the current directory until you type enough that nothing in $path matches, and under some circumstances you can complete a unique name in your $path.

; echo $version
1.7.4 $Release: @(#)rc 1.7.4 v1.7.4-91-g9d071b2 $
; path=(/usr/bin /usr/sbin)
; ls -l ./bootstrap
-rwxr-xr-x 1 cks cks 226000 Jul 27 14:33 ./configure*

In this setup, typing ./boo<TAB> gets a completion to ./bootctl. If you actually try to use this, of course, it doesn't work.

Putting . on $path at least makes ./bootstrap show up in the completion, but rc still offers ./bootctl as well and will still complete to it as well.

I'd be happy to test patches and changes for this. (I took a brief look at the code involved and nothing obvious stood out to me.)

siebenmann avatar Jul 27 '18 18:07 siebenmann

Thanks @siebenmann I guess we'll need to treat ./ and ../ specially. I'll get that sorted soon.

TobyGoodwin avatar Aug 09 '18 09:08 TobyGoodwin

There's a handy isabsolute() in utils.c which does just the job we need.

TobyGoodwin avatar Aug 22 '18 09:08 TobyGoodwin

I have a code fix or workaround for this that appears to work for me and be stable (now linked to above). I can turn it into a pull request if it looks good, or iterate on it for a better fix, depending on what you think about it.

siebenmann avatar Oct 01 '18 16:10 siebenmann

Fixed.

xyb3rt avatar Jun 11 '23 11:06 xyb3rt