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 completions shouldn't move the cursor when there are no completions #4124

Closed
rolag opened this issue Jun 15, 2017 · 4 comments
Closed

Tab completions shouldn't move the cursor when there are no completions #4124

rolag opened this issue Jun 15, 2017 · 4 comments

Comments

@rolag
Copy link
Contributor

@rolag rolag commented Jun 15, 2017

I think it's kind of annoying that fish moves the cursor to the end of a token when <TAB> is pressed and no completions are found.

To reproduce:

# Replace bar '|' with cursor and press <TAB>
mpv --|'https://...very-very-long-url...'
foo /path-typo|:/usr/lib
Version: 2.6.0-65-gedaef4e6-dirty
OS: Linux Debian (Unstable) 
Terminal: gnome-terminal, xterm

If this sounds like a good idea and would be merged, I'd like to have a go at this issue.

@faho
Copy link
Member

@faho faho commented Jun 15, 2017

I believe I agree - getting back to the old cursor position is hard (you need to remember it and then use some movements), while getting to the end of the token is trivial. I can't see a good reason for keeping the status quo - if there is a matching completion going to the end is good because you're most likely done with it, but since there is none here you might need to modify the current token some more - so I'd accept something.

I'd like to have a go at this issue.

Go!

@krader1961
Copy link
Contributor

@krader1961 krader1961 commented Jun 28, 2017

FWIW, I can't tell from the original problem statement what the problem is. And thus cannot evaluate the proposed fix. Is this really a priority for the 2.7.0 release?

The problem appears to be that if you type echo xyz (which doesn't match any files), then move the cursor left to, say, just after the x (which might be valid prefix for some files), then press [tab] it moves the cursor after the z. Which seems reasonable to me. So I suspect I don't understand what the problem is.

@faho
Copy link
Member

@faho faho commented Jun 30, 2017

The problem appears to be that if you type echo xyz (which doesn't match any files), then move the cursor left to, say, just after the x (which might be valid prefix for some files), then press [tab] it moves the cursor after the z. Which seems reasonable to me. So I suspect I don't understand what the problem is.

The issue is that it moves the cursor even when it's not a valid completion. Say I did apt install with the cursor somewhere in the "install" and pressed tab. Fish then moves the cursor to after the token, which is fine because "install" is a valid subcommand for "apt". But if I do "apt isntall" and press tab, it shouldn't move the cursor because I should be fixing that word. It does inform me that it's wrong by blinking, but to then fix the typo I need to move the cursor back again.

This is even weirder because with a correct token (as determined by completions) fish will insert a space after it (so it becomes apt install | with the pipe denoting the cursor). With an incorrect one it won't (apt isntall|).

@krader1961
Copy link
Contributor

@krader1961 krader1961 commented Jul 17, 2017

Retargeting since this appears to be difficult to improve and isn't a priority for 2.7.0.

@krader1961 krader1961 added this to the fish-future milestone Jul 17, 2017
@krader1961 krader1961 removed this from the fish 2.7.0 milestone Jul 17, 2017
krobelus added a commit to krobelus/fish-shell that referenced this issue Sep 10, 2019
Previously, tab-completion would move the cursor to the end of the current token, even
if no completion is inserted. This commit defers moving the cursor until we insert a completion.

Fixes fish-shell#4124
krobelus added a commit to krobelus/fish-shell that referenced this issue Sep 12, 2019
Previously, tab-completion would move the cursor to the end of the current token, even
if no completion is inserted. This commit defers moving the cursor until we insert a completion.

Fixes fish-shell#4124
krobelus added a commit to krobelus/fish-shell that referenced this issue Sep 14, 2019
Previously, tab-completion would move the cursor to the end of the current token, even
if no completion is inserted. This commit defers moving the cursor until we insert a completion.

Fixes fish-shell#4124
@zanchey zanchey removed this from the fish-future milestone Sep 22, 2019
@zanchey zanchey added this to the fish 3.1.0 milestone Sep 22, 2019
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 16, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants