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

Tab completion should suggest unambiguous path #28

Closed
masaeedu opened this issue Oct 24, 2016 · 7 comments
Closed

Tab completion should suggest unambiguous path #28

masaeedu opened this issue Oct 24, 2016 · 7 comments
Labels

Comments

@masaeedu
Copy link

With version 1.1.5, switching between tab completion suggestions only yields the name of the deepest directory. This is not sufficient to unambiguously identify the directory in question, so if you have e.g. the following directories in history:

  • E:\depot\git\TypeScript
  • E:\depot\untracked\typescript11821

There is no way to tab select E:\depot\git\TypeScript. Selecting either option takes you to E:\depot\untracked\typescript11821.

@badmotorfinger
Copy link
Owner

Thanks for submitting this issue.

z will chose a directory based on 'frecency', unless you are explicit with the -Option parameter.

I just tried your directory structure by creating the same folder names and indeed, doing a z typescript did go to typescript11821, however, if I 'cd' into 'typescript' a few times then it will have a higher rank and will be chosen in favour of typescript 11821

@masaeedu
Copy link
Author

masaeedu commented Oct 25, 2016

@vincpa Yes, but if I wanted to go to the closest match I wouldn't be using tab selection anyway, I'd just do z typescript. In this particular case I did z typescript, realized the best match is not the one I need, and now need to go to a different match. This is what tab selection should be useful for. I don't think cd-ing to the other folder manually an indeterminate number of times is a good workflow for choosing between multiple options that are all used frequently.

@badmotorfinger
Copy link
Owner

z is about chosing a match based on frequency of access as determined by this formula
https://github.com/vincpa/z/blob/master/z.psm1#L383

You shouldn't have to cd in to a directory to get a higher rank. I agree, this is a bad workflow. You can press multiple times to get to your selection based on frequency.

I'm sorry if I don't understand the problem you're having. Perhaps you can make a change to the script via a PR or explain it a bit further with a full example with repeatable steps.

@masaeedu
Copy link
Author

masaeedu commented Oct 25, 2016

@vincpa Hopefully a recording will help explain better:

Repro gif

I understand that z uses a particular formula to order matches according to usefulness, which is excellent. However, when an option is selected using tab completion (implemented in #17), the user should be taken to the option that they explicitly selected, instead of once again to the most 'frecent' match. If tab selection is also going to take you to the most 'frecent' match, instead of allowing you to explicitly select which match you want to navigate to, there is no point to having tab selection.

@badmotorfinger
Copy link
Owner

I understand what you are saying now. Thanks for that video :)

Suppose you have two directories with the same name, such as "Temporary
Internet Files" which exists for different versions of .NET. What does
explicit selection then mean? The whole purpose of tab is to present you
with a list in order of 'frecency'.

I do however see usefulness in what you are saying. Let me see if I can fix
this behaviour.

On 25 October 2016 at 12:45, Asad Saeeduddin notifications@github.com
wrote:

@vincpa https://github.com/vincpa Hopefully a recording will help
explain better: https://y8xx7w.by3302.livefilestore.com/
y3muzHoUhfrjrgX2AqGmN7ElKwUJ7W2XFkpcidqShC4bElV-
8PEDCtMLeSVtLrrSpm4D8xE4emveD2Mp67SiQNUEilg-xqhM1B-
jkJm0AWAcp3hUkdSPc0gwmTb81TTW-CVIn7Hhc8E_0o72cY_
FT69pxqCn4jo687HIJ7s5rkkwCI/2016-10-24_21-39-00.gif?psid=1

I understand that z uses a particular formula to order matches according
to usefulness, which is excellent. However, when an option is selected
using tab completion (implemented in #17
#17), the user should be taken to the
option that they explicitly selected, instead of once again to the most
'frecent' match. If tab selection is also going to take you to the most
'frecent' match, instead of allowing you to explicitly select which match
you want to navigate to, there is no point to having tab selection.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#28 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/AAa9d-p2nyi3FyVV52J7VfI5CKaMhWmRks5q3V9EgaJpZM4KfapC
.

@masaeedu
Copy link
Author

Suppose you have two directories with the same name, such as "Temporary
Internet Files" which exists for different versions of .NET. What does
explicit selection then mean?

I would still want to be able to select either of them via tab selection, as differentiated by the full path. Thanks for considering the change.

My personal suggestion would be to do the following:

  • Change the behavior of the positional -JumpLocation argument in the following way: if the argument can be parsed as a rooted path (e.g. ../foo or ./foo or C:/foo/bar), forward the arguments to cdX. Otherwise, treat as a regex as usual
  • Change the behavior of tab completion so that the full path is suggested instead of only the name of the deepest directory. E.g. instead of tab completion suggesting z typescript, suggest z E:\depot\git\typescript

@badmotorfinger
Copy link
Owner

Two suggestions implemented. Closing ticket and will create a release shortly on PowerShell gallery. Thank you for your useful suggestions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants