Skip to content

Return true if there was an autosuggestion to accept#10608

Closed
diniamo wants to merge 3 commits intofish-shell:masterfrom
diniamo:accept-autosuggestion-return-true
Closed

Return true if there was an autosuggestion to accept#10608
diniamo wants to merge 3 commits intofish-shell:masterfrom
diniamo:accept-autosuggestion-return-true

Conversation

@diniamo
Copy link
Contributor

@diniamo diniamo commented Jul 9, 2024

Description

Return true from accept-autosuggestion if there was an autosuggestion to accept, just like suppress-autosuggestion.

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

CHANGELOG.rst Outdated
- ``read --help`` and friends no longer ignore redirections. This fixes a regression in version 3.1 (:issue:`10274`).
- Measuring a command with ``time`` now considers the time taken for command substitution (:issue:`9100`).
- ``fish_add_path`` now automatically enables verbose mode when used interactively (in the commandline), in an effort to be clearer about what it does (:issue:`10532`).
- The `accept-autosuggestion` input function now returns true when there was something to accept.
Copy link
Contributor

@mqudsi mqudsi Jul 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pedantically, I think the real meat of the change is that it now returns false if there wasn't something to accept.

Copy link
Contributor

@mqudsi mqudsi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left a comment about changing the documentation to be "returns true when.." to "returns false when..", if you don't mind changing that.

It would also be nice for this to be accompanied by a test. You can probably model this directly off the recent addition of a pexpect test for commandline --showing-suggestion.

@diniamo
Copy link
Contributor Author

diniamo commented Jul 10, 2024

I'm really not sure how to write the test, so I would appreciate it if someone did it for me.

@mqudsi
Copy link
Contributor

mqudsi commented Jul 15, 2024

In what context are you using this? Can you give an example of how you are invoking this input function? (relevant for how the status code is returned)

@diniamo
Copy link
Contributor Author

diniamo commented Jul 15, 2024

bind -M insert -k nul accept-autosuggestion and execute

is what I would be doing.

@krobelus krobelus added this to the fish 4.0 milestone Oct 5, 2024
@krobelus krobelus closed this in 052e764 Oct 5, 2024
@diniamo
Copy link
Contributor Author

diniamo commented Oct 5, 2024

Thanks!

@krobelus
Copy link
Contributor

going through the changelog I realized we already have commandline --showing-suggestion which should be the canonical version (because it's more flexible) so I'll not changelog this. In fact we can completely get rid of and and or special bind functions, deprecate them and IMO remove them from docs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 27, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants