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

Don't chomp foo= when completing foo=br #7398

Conversation

cstyles
Copy link
Contributor

@cstyles cstyles commented Oct 14, 2020

Description

complete_param_expand knows how to handle cases like foo=br so we
don't need to bother sending just the br part. Furthermore, sending
just br is incorrect because we will end up replacing the entirety of
foo=br with the result of the completion. That is, foo=br will be
replaced with bar instead of being completed to foo=bar.

Fixes a bug where the following

$ foo=/vr<TAB>

will be completed to just

$ /var/

instead of

$ foo=/var/

This doesn't happen when the command is being invoked with env like env foo=/vr<TAB>. It also only occurs when the completion requires replacement. So foo=/va will correctly be completed to foo=/var/.

TODOs:

  • Changes to fish usage are reflected in user documentation/manpages.
  • Tests have been added for regressions fixed
  • User-visible changes noted in CHANGELOG.rst

`complete_param_expand` knows how to handle cases like `foo=br` so we
don't need to bother sending just the `br` part. Furthermore, sending
just `br` is incorrect because we will end up replacing the entirety of
`foo=br` with the result of the completion. That is, `foo=br` will be
replaced with `bar` instead of being completed to `foo=bar`.
@krobelus krobelus added the bug Something that's not working as intended label Oct 14, 2020
@krobelus krobelus added this to the fish 3.2.0 milestone Oct 14, 2020
@krobelus krobelus merged commit da0acb2 into fish-shell:master Oct 14, 2020
@krobelus
Copy link
Member

Right, a fuzzy completion will set COMPLETE_REPLACES_TOKEN, so the entire token is replaced.
We already special-case separators like = in the parameter completion, so we can just reuse that. Thanks!

@cstyles cstyles deleted the fix-bug-with-completing-path-in-variable-assignment branch October 14, 2020 17:04
@cstyles
Copy link
Contributor Author

cstyles commented Oct 14, 2020

No problem!

If it's not too much to ask, could you label this PR as hacktoberfest-accepted? I'm trying to get a free T-shirt. :)

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something that's not working as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants