-
Notifications
You must be signed in to change notification settings - Fork 8.4k
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
Enable alternate scroll mode by default #13187
Comments
I don't think I have much reluctance to enabling this by default. I'll refer to @j4james as our resident VT (and compatibility) expert. It's not like an app that didn't request that mode is going to get anything particularly bad by getting up/down keystrokes. IDK it seems pretty sensible. We could easily make it an opt-out behavior as well, or opt in if there's more compat issues that I'm not aware of. |
Every terminal I've tested that has support for alternate scroll also has it enabled by default, except for XTerm, and even XTerm has an option for that. So yeah, I'm definitely in favour of doing this. And now that the alt buffer doesn't show the scrollback, there's nothing else the scroll wheel can do anyway. That said, if an application has a mouse tracking mode enabled (e.g. mode 1003) at the same time as alternate scroll, that mouse tracking should take precedence (or at least the most recent mode should take precedence). I don't think we're currently doing that, so it's important that we fix that first. |
I'm not sure if I should open a new issue, but I seem to notice that alternate scroll is noticeably slower than normal scrolling (e.g. scrolling in Vim is slower than scrolling the scrollback in the shell). Is this known / expected ? |
That intuitively makes sense to me - if you're using alternate scroll mode, then I'd suspect we send one |
Right. Windows defaults to scrolling 3 lines per wheel detent, but if we translated a single wheel scroll event into three up/down events we would risk overshooting in cases where the wheel is being used to scroll things that aren't linear text buffers. This will also manifest in applications that take over full mouse control rather than the partial control offered by alternate scroll mode: vim, for example, will scroll one line when it receives one "button 5" event (wheel). |
@zadjii-msft This is pretty commonly configurable:
@DHowett What I've usually seen is that alternate scroll mode is consistent with the scrollback behavior (usually more than 1 line per wheel click), and when an application takes over full mouse control, then it's usually 1 line per wheel click (probably because that's easiest to implement). I'm not sure how other terminals handle "overshooting". |
Ah dang, you're totally right. We should make this configurable! Thanks! |
By the way, how to add |
If alternate buffer isn't enabled by default what is required to turn it on or make it turn on by default for all shell sessions? |
It sounds like in bash you enable this with |
In pwsh (7), I believe a |
This PR enables alternate scroll mode by default, and also fixes the precedence so if there is any other mouse tracking mode enabled, that will take priority. ## Validation Steps Performed I've manually tested by viewing a file with `less`, and confirmed that it can now scroll using the mouse wheel by default. Also tested mouse mouse in vim and confirmed that still works. ## PR Checklist Closes #13187
@phil-blain why not opening the issue in the vim repo? terminal user is able to translate wheel events to any number of lines 3 4 5 10 1, so it shall be a user configuration, not terminal. i dont really understand what alternate scroll 1007 does, seem like a poor design to me, similar to 1005 |
I'd think the typical use case for this is to scroll or navigate in a linear text buffer, like in "less", or "nano" or other terminal editors, which, even if they support mouse mode, might not be enabled by default and/or not obvious how to configure, or might have some tradeoffs which the user prefers to avoid. For instance, enabling mouse at the application (rightly) disables terminal selection by mouse drag (even if shift-drag still works, but less convenient), so the user might prefer to rely on alt-terminal-scroll and keep the mouse disabled at the app, so that they can select text without shift. It's certainly possible that the user prefers one-line-at-a-time, or having other use cases (which I can't think of) where multiple-lines are counter productive, which is why it would be useful to have the number of lines configurable. But I don't think it can be argued that scrolling one line per wheel event is great when the user prefers 3 or 5 lines at a time. |
I was really pleased to see that proper support for the alt screen buffer has landed in the latest preview release (thanks to #12569). Would you consider enabling this behavior by default? I realize that you could just add a
printf "\e[?1007h"
to your shell startup script, but most terminals that I use have this mode enabled by default. This issue in thefoot
repository summarizes the issue nicely.The text was updated successfully, but these errors were encountered: