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

Leverage actions-on-current-suggestion as a list. #2632

Closed
wants to merge 1 commit into from

Conversation

aadcg
Copy link
Member

@aadcg aadcg commented Nov 9, 2022

Description

After #2555, we can now think about how this new feature translates into something useful for users!

I'd like to collect ideas from you on this topic. @Ambrevar @jmercouris @aartaka

I've added a dumb example with respect to hint-mode. When actions-on-current-suggestion is a list, you can set the default action that runs when the current suggestions changes.

Example:

  • issue follow-hint and notice that issuing select-next and select-previous runs the default action on selection change (highlighting the hint on the web page's buffer)
  • issue set-selection-action and set for instance scroll-to-selected-hint
  • notice that now you get highlighting plus scrolling.

Checklist:

Everything in this checklist is required for each PR. Please do not approve a PR that does not have all of these items.

  • I have pulled from master before submitting this PR
  • There are no merge conflicts.
  • I've added the new dependencies as:
    • ASDF dependencies,
    • Git submodules,
      cd /path/to/nyxt/checkout
      git submodule add https://gitlab.common-lisp.net/nyxt/py-configparser _build/py-configparser
    • and Guix dependencies.
  • My code follows the style guidelines for Common Lisp code. See:
  • I have performed a self-review of my own code.
  • My code has been reviewed by at least one peer. (The peer review to approve a PR counts. The reviewer must download and test the code.)
  • Documentation:
    • All my code has docstrings and :documentations written in the aforementioned style. (It's OK to skip the docstring for really trivial parts.)
    • I have updated the existing documentation to match my changes.
    • I have commented my code in hard-to-understand areas.
    • I have updated the changelog.lisp with my changes if it's anything user-facing (new features, important bug fix, compatibility breakage).
    • I have added a migration.lisp entry for all compatibility-breaking changes.
  • Compilation and tests:
    • My changes generate no new warnings.
    • I have added tests that prove my fix is effective or that my feature works. (If possible.)
    • New and existing unit tests pass locally with my changes.

(lambda-command scroll-to-selected-hint* (suggestion)
"Highlight and scroll to hint."
(highlight-selected-hint :element suggestion :scroll t))
(lambda-command copy-selected-hint* (suggestion)
Copy link
Contributor

Choose a reason for hiding this comment

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

Does it actually make sense as a selection action?

A crazy idea: make both selection-actions and return-actions accessible in the return-marks-action and set-selection-action?

Copy link
Member Author

Choose a reason for hiding this comment

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

You're referring to copy-selected-hint* right? Actually I had this idea written down and I know I took it from you! It could very well be that I misunderstood you somehow. Note that right now it's not very useful since the URL might be relative (e.g. #potatoes), but that's an issue orthogonal to this PR...

A crazy idea: make both selection-actions and return-actions accessible in the return-marks-action and set-selection-action?

I think I understand what you mean and I agree. The only obstacle is that return-actions run over marks whereas selection-actions run over a single element (the suggestion).

Actions should be defined in such a way that it could be used in both cases. If we look at the particular of hint-mode, then we could use for instance focus* in whatever context.

(lambda (suggestion)
(highlight-selected-hint :element suggestion
:scroll nil))))
(list (unless (fit-to-prompt-p (find-submode 'hint-mode))
Copy link
Contributor

Choose a reason for hiding this comment

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

Are NIL values deleted from the selection-actions list? Maybe they should be...

Copy link
Member Author

Choose a reason for hiding this comment

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

That's a good point! I think they should. Should have been part of #2555...

@Ambrevar
Copy link
Member

Looks reasonable to me :)

@aadcg
Copy link
Member Author

aadcg commented Nov 16, 2022

Let's postpone this for later, since there are more pressing issues at the moment.

@aadcg aadcg added low 3-series Related to releases whose major version is 3. labels Nov 16, 2022
@aadcg aadcg changed the title Leverage selection-actions as a list. Leverage actions-on-current-suggestion as a list. Feb 7, 2023
@aadcg aadcg removed the 3-series Related to releases whose major version is 3. label Apr 24, 2023
@aadcg
Copy link
Member Author

aadcg commented May 3, 2023

Closing this PR as there isn't much interest in these features as of now.

@aadcg aadcg closed this May 3, 2023
@aadcg aadcg deleted the leverage-selection-actions-as-list branch May 3, 2023 17:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

3 participants