-
-
Notifications
You must be signed in to change notification settings - Fork 403
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
Add combined version of hinting modes #3241
Comments
Related to #2972. This is important, but not our top most priority right now. While the mode can be improved, the request is somewhat inconsistent. In order to choose a link via some of its text, the prompt buffer is paramount since there may be multiple matches. Also the prompt buffer enables acting on several links at once via |
relevant design idea from a user:
|
No, the request is not inconsistent, but maybe you are misunderstanding something. There is no need for the prompt buffer in the mode I am suggesting. I am suggesting that the hint labels are narrowed down while typing. If we need to choose between several matching links we could still cycle through the remaining hint labels with a keybind. Yes, I see the value of acting on several links at once, and this is possible in the default mode, but not in vi mode or the mode I propose, so here the user would need to choose modes based on what they value most.
I agree with this, which is the behaviour I expect from hinting, at least when typing the exact hint letters. This would be nice to have, even as a toggleable option. |
@lrustand you're suggesting a mode that follows
This is the default behavior in Nyxt is configurable, but that doesn't mean that it must support all use cases. Each user has its requirements, so we should stick to the most general and reasonable default. Specific workflows can be achieved by personal configuration or public extensions. |
Thanks for letting me know about
I hear what you are saying, and I agree that the current behaviour should be the default, but I still would like to have the ability to toggle it with an option. Also, if it is unreasonable or not should be up to each user to decide for themselves, no?
Yes, I agree 100%. I'm not asking for any defaults to be changed, only to be able to configure it how I want. I don't think what I'm proposing is unreasonable at all, the behaviour I'm describing is exactly how link hinting worked in either Tridactyl or Pentadactyl (don't remember which), and I do believe Qutebrowser can be configured to work like this as well. Also, this does not really need to be a separate mode. It could just as well be a set of configuration options for example |
See #2865 for context. If a set of parameters is available for configuration, then we must ensure that all combinatorial combinations make sense. It is our responsibility to ensure that the configuration space isn't broken by design. By configuration space I mean the set of parameters that is easily configured, e.g. mode slots. It is important to distinguish that kind of configuration, which is bounded by what the API provides, from arbitrary configuration, which is still made possible by loading arbitrary code in the config file. The kind of hint behaviour that you have described, up to my best understanding, is achieved by the command below. I don't consider it good enough. Example, at (define-command-global custom-follow-hint ()
"Experimental prompt for element hints and open them in the current buffer."
(prompt :prompt "Interact with element"
:extra-modes (list 'nyxt/mode/hint-prompt-buffer:hint-prompt-buffer-mode)
:auto-return-p t
:history nil
:height :fit-to-prompt
:hide-suggestion-count-p nil
:sources
(make-instance
'nyxt/mode/hint::hint-source
:enable-marks-p t
:filter-preprocessor
(lambda (suggestions source input)
(declare (ignore source))
(loop for suggestion in suggestions
for hint = (prompter:value suggestion)
for hinted-element-id = (nyxt/dom:get-nyxt-id hint)
if (str:starts-with-p input
(prompter:attributes-default suggestion)
:ignore-case t)
do (nyxt/mode/hint::set-hint-visibility hint "visible")
and do (when (nyxt/mode/hint::show-hint-scope-p (find-submode 'nyxt/mode/hint:hint-mode))
(ps-eval
(nyxt/ps:add-class-nyxt-id hinted-element-id
"nyxt-element-hint")))
and do (nyxt/mode/hint::dim-hint-prefix hint (length input))
and collect suggestion
else do (nyxt/mode/hint::set-hint-visibility hint "hidden")
and do (when (nyxt/mode/hint::show-hint-scope-p (find-submode 'nyxt/mode/hint:hint-mode))
(ps-eval
(nyxt/ps:remove-class-nyxt-id hinted-element-id
"nyxt-element-hint")))))
:actions-on-return
(list (lambda-command click* (elements)
(dolist (element (rest elements))
(nyxt/dom:click-element element))
(nyxt/dom:click-element (first elements))
nil)
(lambda-command focus* (elements)
(dolist (element (rest elements))
(nyxt/dom:focus-select-element element))
(nyxt/dom:focus-select-element (first elements))
nil))
:constructor
(lambda (source)
(declare (ignore source))
(nyxt/mode/hint::add-hints
:selector "a, button, input, textarea, details, select")))
:after-destructor (lambda () (with-current-buffer (current-buffer)
(nyxt/mode/hint::remove-hints))))) As mentioned, |
Thanks, that's great! This solves one part of my initial request. The narrowing of hint labels when typing parts of the hint works well, but I'm still having problems getting link text matching to work, it only matches against the hint labels. One slightly strange thing with this hint command is that the current selection is always somewhere off screen and I have to press down arrow 3-5 times before the selection is a hint that is actually on the screen. After some more testing I realize that this happens in the default hinting mode as well.
Yes, that is true and I forgot about this problem. This could be solved in a few different ways:
The first one should already be possible through user configuration, and the second one seems like a sane default. Number 3 is more experimental I think, but seems like it could work pretty smooth. The other browser where I've seen this behaviour used option 1. Also, all types of hinting has some drawback. For me personally this would be a big improvement even though it has this small "drawback". These sort of things depend very much on personal preference though, so this is why it makes sense to have these things as configuration options. I see that similar hinting style has been suggested in #2972, and that you did not think it was a good idea to use numbers. You highlighted a problem when the link contains numbers. I have however used this exact hinting style for several years previously and never ran into this problem in practice. And it could be very easily circumvented by just typing a different part of the link text that does not contain numbers, or falling back to using the hint label in these specific edge cases. Also, point two in the list above.
I don't agree with this at all, I think it is up to the user to make sure their configuration combination makes sense. Having a powerful set of config options always makes it possible to do stupid stuff, and I'm sure there are plenty of ways to combine some of the options that already exist in Nyxt in ways that don't make sense too. You seem to dismiss a lot of very sensible user suggestions simply because it is not something you personally would like to use, instead of allowing it to be a configuration option that the users that do find it useful can enable. These things obviously have some demand since there has been several similar issues.
Nice, I'm looking forward to see the outcome of this! I will try to experiment a bit with some custom hint commands, although I'm still a beginner lisper. Your code above will be a good starting point for me. |
Some pointers towards your goal:
Because
Tip: tweak
I don't think I have mentioned any of my personal preferences when it comes to
That was precisely my goal. Happy hacking! |
We have had many users over the years claiming that it is unacceptable for But now that we have the command Reviewing |
Is your feature request related to a problem? Please describe.
The default hinting mode is great with the ability to type in link text in addition to the hint labels in order to narrow down the results, but the prompt buffer is taking up too much screen real estate and is covering up the links on the bottom of the page. Vi hinting mode hides the prompt buffer, but only allows to type the actual hints and not the link text like the default hinting mode. Additionally, the hint labels do not get narrowed down when typing in either of the modes, only the prompt buffer results get narrowed down.
Describe the solution you'd like
I suggest adding a combination of the default hinting mode and the vi hinting mode, where the text input works like in the default hinting and the prompt buffer is hidden.
Describe alternatives you've considered
I tried using the vi hinting mode, but I really miss being able to narrow hte results down by typing in some of the link text.
Additional context
Add any other context or screenshots about the feature request here.
The text was updated successfully, but these errors were encountered: