-
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
Add a spec for output snapping #2529
Conversation
what happens if |
In clearing the selection, you'd just be turning the event listener on. So the viewport would remain where it is assuming I think an important thing for me to check in this implementation is that clearing the selection should also count as a trigger for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a couple questions
Proposal: can we also have the option to auto scroll only if the last line is visible? This way if I start scrolling up (even without selecting anything), the console will not auto-scroll anymore and will stay whereever I scrolled to. As soon as I scroll back down to the last line, the auto-scroll can resume. I think that's how iTerm2 works by default, and that's pretty awesome and intuitively does what I expect. |
FYI, there are a couple of private mode escape sequences that some terminals use to control this kind of thing. Mode 1010 specifies whether to snap to the bottom on output, and mode 1011 specifies whether to snap to the bottom on a keypress. If there's a chance we may also want to support these modes one day, it's worth considering how they might interact with this setting. |
Hey maybe we should bump this, it probably should make the 1.0 cut |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a couple of non-blocking thoughts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mostly want this comment called out explicitly, because I think atBottom
is what I want from the default value, but I'm not exactly sure
But |
@mnpenner we don’t often get community input during our spec phase, so I’m so glad you’re here 😄 |
Adding support for an array AND a singular value. I do kinda like the idea of |
I need to add the following:
I think the right behavior here is to not allow for that to happen. So, this would be the schema for accepted values:
This way, if the user tries to add always/never to the array, the parsing fails and we fallback to the default value. |
New ideaWhat if we actually don't need to make this configurable. Just change the behavior so that...
And on top of that, introduce a This covers the following scenarios...
(include your thoughts below) |
For reference, it looks like other terminal emulators don't make this configurable. Took a look at iTerm2 and gnome terminal. |
Scrolling up a bit or making a selection both give a very intuitive behavior in my experience. I'd strongly suggest avoiding the scrollLock key, as there's no visual indicator on most keyboards I've seen these days that show what its state is (I'm typing on one now). That would then turn it into an invisible "make scrolling not work right" key (unless there's a real obvious Terminal UI indication that the scroll lock key is toggling this behavior). |
Taking a look at the ScrollLock key in wikipedia. It looks pretty awful. Looks like the key rarely actually does something. In Unix consoles, Ctrl+S and Ctrl+Q freeze and unfreeze the output respectively. But here's the kicker, the shell is freezing the output, not the terminal. If you try this on PowerShell, for example, Ctrl+S does 'Forward Search History' instead thanks to Powerline. So
Scrolling up a bit or making a small selection isn't too bad of a solution. So we can just cut the |
Just to make things more confusing, note that there is also a Pause key, that pauses the output in the conhost console (pressing any other key will resume scrolling). Not that I'm asking for Windows Terminal to replicate that functionality, but thought it worth mentioning in case anyone else thinks that level of compatibility is worth considering. |
The latest commit introduces a major change. As I mentioned above, what if we made this not configurable. The rest of the spec records the ideas we've discussed here, and provides some reasoning for why not make it configurable. Because of this, I'm dismissing the past approvals as stale. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I think after all this discussion, I'm on board with this. I'll be shocked if anyone really wants "scrollOnOutput": "always"
or "pauseScrollingOnSelect": false
, but we could always add those in the future if there was huge demand, now that we've enumerated that those settings would work like that.
Co-authored-by: Mike Griese <[email protected]>
Renamed PR to be in imperative mood |
Before you merge this, rewrite the description to explain what's really happening. |
Hello @DHowett! Because this pull request has the p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (
|
## Summary of the Pull Request Updates the Terminal's scroll response to new output. The Terminal will not automatically scroll if... - a selection is active, or - the viewport is at the bottom of the scroll history ## References #2529 - Spec #3863 - Implementation ## PR Checklist * [X] Closes #980 * [X] Closes #3863 * [ ] Tests added/passed * [ ] Requires documentation to be updated ## Detailed Description of the Pull Request / Additional comments Updates the `_scrollOffset` value properly in TerminalCore when the cursor moves. We calculate a new `_scrollOffset` based on if we are circling the buffer and how far below the mutable bottom is. We specifically check for if a selection is active and if the viewport is at the bottom, then use that as a condition for deciding if we should update `_scrollOffset` to the new calculated value or 0 (the bottom of the scroll history). ## Validation Steps Performed Manual testing. Though I should add automated tests. - [X] new output - [X] new output when circling - [X] new output when circling and viewport is at the top
Any progress on this? It's been a couple years and the lack of this feature is quite annoying. |
@jstr045329 You probably want to go upvote #8879. This thread was a spec review from a few years ago now. The Terminal will "snap on input", but not output. #8879 is tracking that request. |
Summary of the Pull Request
This proposes a change to how Terminal will scroll in response to newly
generated output. The Terminal will scroll upon receiving new output if
the viewport is at the bottom of the scroll history and no selection is
active.
This spec also explores the possibility of making this response
configurable with a
snapOnOutput
profile setting. It also discussesthe possibility of adding a scroll lock keybinding action.
PR Checklist