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

exec.space_prefix setting doesn't take effect until second input line #73

Closed
Roze061 opened this issue Feb 15, 2021 · 10 comments
Closed
Labels
bug Something isn't working

Comments

@Roze061
Copy link

Roze061 commented Feb 15, 2021

but it seems to be just auto complete for commands that do not work.
I added spaces to ignore history

clink: 1.1.29

@Roze061 Roze061 changed the title auto complete tab doesn't work if adding spaces at the beginning of a command Tab auto completion doesn't work if adding spaces at the beginning of a command Feb 15, 2021
@chrisant996
Copy link
Owner

chrisant996 commented Feb 16, 2021

Can you please give some specific examples?

What steps are followed, what is expected to happen, and what happens instead?

Also, yes, it's intended that typing spaces at the beginning of the line changes how completion works. See the exec.space_prefix and related Clink exec. settings in the documentation. Does that explain what's happening, or is something else happening?

Thanks!

@Roze061
Copy link
Author

Roze061 commented Feb 16, 2021

Thanks @chrisant996 now I can use Tab completion first word with space prefix after set exec.space_prefix to False
sorry i didn't figure out exec.space_prefix before making it an issue

but when I do this
run cmd > cd "New Folder" > clink inject > input " his" or " cm" > press Tab
Tab completion not suggesting

but when I do this
run cmd > cd "New Folder" > clink inject > input & enter " -anything" > input " his" or " cm" > press Tab
Tab completion work

and when I run " history" after clink inject, 'history' is not recognized as an internal or external command, operable program or batch file.
" exit" command work

clink info

version : 1.1.29.d6b2fc
session : 6860
binaries : D:\Program Files\Scoop\apps\clink\current
state : D:\Program Files\Scoop\apps\clink\current\profile
log : D:\Program Files\Scoop\apps\clink\current\profile\clink.log
settings : D:\Program Files\Scoop\apps\clink\current\profile\clink_settings
history : D:\Program Files\Scoop\apps\clink\current\profile\clink_history
scripts : D:\Program Files\Scoop\apps\clink\current\profile\scripts;D:\Program Files\Scoop\apps\clink\current\profile\clink-completions-master
inputrc : %clink_inputrc%
D:\Program Files\Scoop\apps\clink\current\profile.inputrc (exists)
D:\Program Files\Scoop\apps\clink\current\profile_inputrc (exists)
: %userprofile%
C:\Users\user.inputrc
C:\Users\user_inputrc
: %localappdata%
C:\Users\user\AppData\Local.inputrc
C:\Users\user\AppData\Local_inputrc
: %appdata%
C:\Users\user\AppData\Roaming.inputrc
C:\Users\user\AppData\Roaming_inputrc
: %home%
C:\Users\user.inputrc
C:\Users\user_inputrc

@chrisant996
Copy link
Owner

chrisant996 commented Feb 16, 2021

but when I do this
run cmd > cd "New Folder" > clink inject > input " his" or " cm" > press Tab
Tab completion not suggesting

but when I do this
run cmd > cd "New Folder" > clink inject > input & enter " -anything" > input " his" or " cm" > press Tab
Tab completion work

Oh, the issue is the space in "New Folder". [UPDATE: oops, no, I had a typo]

Can you clarify the steps for how to reproduce the problem?

  • Please share specific steps, since for example we may interpret "type anything here" differently and that could accidentally hide the problem through unexpected side effects of our different random choices.
  • You mean follow the steps after running clink set exec.space_prefix false as a first step, right?
  • What does input & enter " -anything" mean?
  • Is "New Folder" relevant, do I need to create a folder named "New Folder" first?
  • What does input " cm" mean? Do you mean type literally Quote Space c m Quote and then complete? (That would be expected to not complete because the quote placement makes the space part of the command name, and there's nothing named " cm*".)
  • If you mean simply type Space c m Tab then that seems to be working for me (with exec.space_prefix set to False), so I think maybe I'm not understanding the steps, or there is some configuration or repro step(s) that haven't been captured yet.

and when I run " history" after clink inject, 'history' is not recognized as an internal or external command, operable program or batch file.
" exit" command work

This is expected behavior; history is not a built-in command (it doesn't exist in CMD). When Clink is injected, it defines history as a doskey alias that runs clink history (and defines clink as a doskey alias that expands to the full path of the Clink that was injected (thus the Clink directory doesn't need to be on the %PATH%).

Inserting leading spaces turns off doskey expansion in Clink, just like it turns off doskey expansion in CMD.

If you want to be able to type spaces before history and still have it work, you could make a history.cmd batch file that calls clink history and passes along the rest of the command line arguments.

@Roze061
Copy link
Author

Roze061 commented Feb 16, 2021

Oh, the issue is the space in "New Folder".

"New Folder" for example where current working directory

@chrisant996 chrisant996 added the needs more information The issue needs clarifying information label Feb 16, 2021
@Roze061
Copy link
Author

Roze061 commented Feb 16, 2021

You mean follow the steps after running clink set exec.space_prefix false as a first step, right?

Yes and exit

What does input & enter " -anything" mean?

type some word and enter.
ex: after clink inject running clink set exec.space_prefix false

If you mean simply type Space c m Tab then that seems to be working for me (with exec.space_prefix set to False), so I think maybe I'm not understanding the steps,

You are right simply type

or there is some configuration or repro step(s) that haven't been captured yet.

clink-d6b2fc
1.1.29.zip
exec.space_prefix = False
Sorry for quality

@chrisant996
Copy link
Owner

chrisant996 commented Feb 17, 2021

In the gif I see attempts to complete prefixes of clink and history.

It's correct for those to not complete:

  • Clink automatically defines clink and history as doskey aliases.
  • Doskey aliases are only expanded at the beginning of a line; leading spaces in both CMD and Clink turn off doskey alias expansion.
  • Since doskey aliases won't work when preceded by spaces, they also won't complete when preceded by spaces.

The reason clink works anyway when executed is because clink.cmd is in the %PATH% (which can be seen at one point in the git), and that's what ends up getting invoked.

Everything appears to be working correctly in the gif.
If it seems like I'm misunderstanding something that's being reported, please do clarify and help me to understand.

Thank you very much for taking the time and effort to report the scenario and make a gif movie of it to help me see what was happening!

@Roze061
Copy link
Author

Roze061 commented Feb 17, 2021

in gif after clink inject in first line I trying to Tab completion but not work
at least I have to manually write the executable name after "clink inject" and the parameters can be auto-completed. but after the first run something will work as usual
if history prefix with space still completing

Yes, I'm able to get it to sometimes complete things prefixed with spaces even when it shouldn't.

I have no problem with that, thank you if you want it to be refined

This is expected behavior; history is not a built-in command (it doesn't exist in CMD). When Clink is injected, it defines history as a doskey alias that runs clink history (and defines clink as a doskey alias that expands to the full path of the Clink that was injected (thus the Clink directory doesn't need to be on the %PATH%).

Inserting leading spaces turns off doskey expansion in Clink, just like it turns off doskey expansion in CMD.

I see

at least I have to manually write the executable name after "clink inject" and the parameters can be auto-completed. but after the first run something will work as usual

maybe I'm the only one who has this problem

I'll work on tracking it down.

Thank you @chrisant996

can i ask?can i use z.lua with clink without lua program

@chrisant996 chrisant996 added bug Something isn't working and removed needs more information The issue needs clarifying information labels Feb 17, 2021
@chrisant996
Copy link
Owner

Oh, I see now:

Yes, I'm able to get it to sometimes complete things prefixed with spaces even when it shouldn't.

That's what you're pointing out, right?

Thank you for persisting until I was able to reproduce what you're reporting. 🙃

@chrisant996
Copy link
Owner

at least I have to manually write the executable name after "clink inject" and the parameters can be auto-completed. but after the first run something will work as usual

maybe I'm the only one who has this problem

I got it to happen a couple times, but it's intermittent and hard for me to get it to start happening. Although we are experiencing opposite symptoms, I think the cause is very likely the same for both. The symptoms are consistent with an uninitialized variable somewhere, or missing a spot where some variable needs to get reset.

I'll work on tracking it down.

@chrisant996
Copy link
Owner

chrisant996 commented Feb 18, 2021

It turned out be a problem in loading settings that are defined in Lua scripts (the exec matching is defined in some built-in Lua scripts). A change in v1.1.4 wasn't fully correct, and caused settings define in Lua scripts to not take effect until the second input line.

@chrisant996 chrisant996 changed the title Tab auto completion doesn't work if adding spaces at the beginning of a command 'exec.space_prefix` setting doesn't take effect until second input line Feb 18, 2021
@chrisant996 chrisant996 changed the title 'exec.space_prefix` setting doesn't take effect until second input line exec.space_prefix setting doesn't take effect until second input line Feb 18, 2021
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