nyxt icon indicating copy to clipboard operation
nyxt copied to clipboard

Add global option to wrap over prompt buffer suggestions

Open Ambrevar opened this issue 3 years ago • 8 comments

When reaching the bottom / top in the minibuffer, going further should wrap over and bring us to the top / bottom respectively.

Ambrevar avatar Sep 25 '20 18:09 Ambrevar

It should be really obvious that the list wraps, maybe a sentinel element or something so that the user understands that they've reached the end.

jmercouris avatar Sep 25 '20 19:09 jmercouris

The indicator used should be configurable and with a sensible default. Internal speaker beeping upon hitting the end should be an option, as should playing an arbitrary sound through external speakers or headphones. Some mechanism should be available (configurably) to prevent a user from wrapping accidentally.

Jemi avatar Nov 24 '20 05:11 Jemi

The new prompt-buffer library has full wrap-over support. It's tested.

However the interface is not exported and we don't use it in Nyxt. The reason being that I don't really see a use case in Nyxt: if you want to go back to the beginning, M-< or home will do the job.

Can anyone see a good reason to enable wrap-over in the prompt-buffer?

Ambrevar avatar Apr 27 '21 11:04 Ambrevar

I cannot, in fact I find it just confusing when lists wrap over.

jmercouris avatar Apr 27 '21 12:04 jmercouris

There is a use case. Namely, it's easier. However, it has to be done correctly, hence my comment. So as a basic example: you're a new user, you don't know anything about use of M-< or home in the minibuffer (and incidentally, I'm on nyxt 1.4 still and just tested the ctrl-space 'execute command minibuffer', neither M-< nor HOME seem to be implemented in that version). You open up a minibuffer and scroll down to the last page (using PGDOWN? - Seems not to be implemented yet in 1.4). Upon hitting the last page, the PC-speaker beeps and the minibuffer does an animation, turning light blue and then slowly fading back to white (as an example). You hit pgdown one more time and it wraps over to the top of the minibuffer. You hit pgup and there is a beep (no animation for this). You hit pgup one more time and you are back at the last page. You make your selection. Two minutes later, you open up the minibuffer again, and this time you hit pgdown way faster than before. Nyxt detects that you are rapidly pressing down the pgdown key, and in spite of the fact that you've hit pgdown an extra three times after hitting the last page, Nyxt doesn't scroll over automatically. Instead it does its animation and its PC-speaker beeps. Once you've paused your rapid fire 'extra' pgdown presses, Nyxt becomes ready for wrapover. So after a (configurable) 200 ms pause, you hit pgdown again and it wraps over.

In this scenario, you didn't have to know about M-<, and you didn't have to guess that HOME would work. You had already guessed that pgdown would do the expected thing, and that was the only button you had to press to go back to the top upon hitting the last page - the same button you were already pressing. The animation and the PC-speaker beep and the required 200 ms pause meant it was guaranteed you knew what you were doing when you wrapped around. So it had to be implemented correctly to avoid confusion, but the wraparound greatly simplified things, making the experience intuitive for a new user who previously had no idea what a minibuffer even was. The new user had to figure out the keybinding to open the minibuffer in the first place, once that effort was already put in, the experience became intuitive and easy.

I would add, emacs keybindings suck, and VI style keybindings aren't really any better except for the fact that they are modal. The 'suckiness' of emacs keybindings should be their virtue, acting as a fallback for cases when nothing better is available. Custom keybindings should be improved, and the primary way of interacting before any custom keybindings have been setup and before any 'serious' quantity of emacs keybindings have been learned should be through minibuffers. Consequently, these minibuffers should be intuitive and easy for new users.

Jemi avatar Apr 27 '21 22:04 Jemi

Thanks for your feedback.

I'm happy to announce that most of your concerns have been addressed in the latest pre-release and on master.

  • CUA bindings are now the default.
  • The "minibuffer" is now the prompt buffer and there is a "menu" button you can click on. New users can thus easily discover it.
  • Page down, page up, home, end, all work as expected.
  • Bindings are discoverable via f1 b. The help keys are all prefixed by f1.

Following your rationale, the user had to guess at least one binding, here "pagedown", which they guess from their use of CUA applications. In the new version of the prompt buffer, the familiar CUA keys are bound

  • all bindings are easily discoverable, so in my understanding, wrapping over is no longer a concern.

What do you people think?

Ambrevar avatar Apr 28 '21 08:04 Ambrevar

Command set-current-suggestion accepts the parameter wrap-over-p. There could be a slot in source/prompt-buffer that would set this option globally for all prompt buffers.

aadcg avatar May 30 '23 09:05 aadcg

Yes!

aartaka avatar May 30 '23 12:05 aartaka