Skip to content
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

Completion problem with two levels or more of ../ #57

Closed
AiZ opened this issue Jan 19, 2021 · 3 comments
Closed

Completion problem with two levels or more of ../ #57

AiZ opened this issue Jan 19, 2021 · 3 comments
Labels
bug Something isn't working

Comments

@AiZ
Copy link

AiZ commented Jan 19, 2021

Hello,

First, thank you for keeping this marvellous tool alive!

I have just migrated from 0.4.9 to 1.1.22 and so far so good, everything is Ok, except one thing.

If I complete more than one ../, only the last slash is converted to backslash. It's ok to change directory but not for executing programs ('..' is not recognized as an internal command or etc.).

clink01

Or maybe I missed something in the help file. I've made nearly no tuning to feel at home with your version, keeping previous settings file (almost vanilla from 0.4.9), history and just binding scrolling to Shift-PgUp/PgDn in .inputrc.

Do you experience the same behaviour?

Regards,

AiZ
@chrisant996
Copy link
Owner

Thank you for reporting this. I see where the problem is occurring, and it only happens for built in match generators for the first word (and only when exec.match is enabled) and for cd etc. It doesn't happen for echo ../../scomplete or for ;echo ../../scomplete or fooexe ../../scomplete or etc -- those normalize all the path separators to backslash.

@chrisant996 chrisant996 added the bug Something isn't working label Jan 19, 2021
chrisant996 added a commit that referenced this issue Jan 21, 2021
chrisant996 added a commit that referenced this issue Jan 21, 2021
Using `path.normalise()` condenses `.\` and `..\` components, which
breaks filtering matches.  Instead only replace `/` with `\`.
@chrisant996
Copy link
Owner

It turns out that in CMD typing foo/bar means it's actually gets executed as foo /bar. I discovered that as part of updating the input line coloring parser to more accurately match how CMD actually interprets the command line.

And I fixed Clink to work accordingly some time ago. So, this issue 57 is back to "not working".

Except that it's actually technically working properly now. 🙃

Trying to make folder/filename completion work (in the first word on a command line) means that program/flag cannot work. Or vice versa.

I feel that it's appropriate for Clink to match how CMD actually works.

So, I'm going to let issue 57 stay "broken" since that's actually "correct".

Sorry that it's so confusing. Windows and CMD are not the same as Linux and bash, and Clink can't overcome that all by itself, at least not without breaking normal Windows and CMD behaviors (which causes other problems).

@chrisant996
Copy link
Owner

Or, if you want to type ../whatever in the first word and use completion, then CMD needs a " inserted: "../whatever will allow completion to work as desired.

I know it isn't like bash or Linux. But this isn't bash or Linux, and it's important to stay compatible with how CMD actually works.

chrisant996 added a commit that referenced this issue Jun 11, 2024
clink.filematches() always converted forward slashes to backslashes,
related to #57.  But it shouldn't convert slashes there, and also it
wasn't correct to treat `../foo` as a relative path anyway, since CMD
actually interprets `foo/bar` as `foo /bar` -- the slash is interpreted
as a switch character, not as a path separator.

Additionally, this change also makes "off" mode preserve typed forward
slashes and backslashes (e.g. completing `/foo/` became `/foo\bar\`,
but the expected behavior is really `/foo/bar\`).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants