-
Notifications
You must be signed in to change notification settings - Fork 8.5k
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
Scrolling within regions that include the top of the screen doesn't push lines into scrollback #3673
Comments
I think this is related to the scrolling margins. You'll see a similar problem when setting the scrolling margins to the first 10 lines of the screen with a bash command like this:
Then try doing a directory listing or output a lot of content that will cause the view to scroll. The scrolling will be limited to the top 10 lines, as expected, but anything that scrolls off the top of the screen is lost. I think this is just a limitation of the current conpty implementation. It doesn't know anything about scrolling regions, so unless you're scrolling the full screen height, it won't update the scrollback buffer correctly. |
We'll need to capture some VT from minicom to figure out exactly what it's doing here. Would you be willing to run it under |
This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. |
I'm experiencing the same issues. |
Sure! Check this out. If you run Here's the steps, roughly.
The file looks something like this: All of those blue characters are the raw escape sequences that came out of my shell, and for you will be the ones coming out of minicom. |
Attached is a script file |
Thanks a lot! Just to make sure: I am seeing the bottom bar, which is red, duplicated multiple times on the screen. Is that the only issue? If there's more issues than that, would you mind sharing a screenshot? |
(If it's the bug where the scrollback is deleted, that's just how it's designed right now, unfortunately.) |
Yes, the red bottom bar is fine - no problem here. It's part of minicom when enabling color mode. |
Ah! Thanks again for the test case. James's initial suspicion is right: there's a scrolling region, and we don't handle that great right now. |
I'm re-opening this to track the scrolling margins + conpty issue, and tossing it on the backlog. Thanks! |
Hi, is there any plan to fix this issue soon? |
@ThomasHornschuh Not particularly - it's being tracked as a part of our "Next Windows Release" milestone, but that doesn't really have any sort of timeline (certainly not one I can share publicly). Sorry about that! |
Just writing to say I found this post googling the same issue.
It's only in Windows Terminal where it's all screwy and annoying. :( Thanks for the hard work though guys! I'm a big fan of terminal! |
Any news for this issue? |
Nope. We'll make sure to update this thread when there is. In the meantime, might I recommend the Subscribe button? This is also vaguely similar to #6056. I'm xlinking just in case, but I might be totally off base on that. Telnet doesn't actually use the margins, and I believe our theory with that one is that telnet.exe is actually running its own VT parser and using the Console API to scroll the buffer. But, that might be a similar enough scenario that doesn't work in ConPTY that we may want to come up with a universal solution to both. |
FYI, I think I may have inadvertently fixed this issue while I was working on merging the |
That's quite exciting! 😄 |
The main purpose of this PR was to merge the `ITerminalApi::LineFeed` implementations into a shared method in `AdaptDispatch`, and avoid the VT code path depending on the `AdjustCursorPosition` function (which could then be massively simplified). This refactoring also fixes some bugs that existed in the original `LineFeed` implementations. ## References and Relevant Issues This helps to close the gap between the Conhost and Terminal (#13408). This improves some of the scrollbar mark bugs mentioned in #11000. ## Detailed Description of the Pull Request / Additional comments I had initially hoped the line feed functionality could be implemented entirely within `AdaptDispatch`, but there is still some Conhost and Terminal-specific behavior that needs to be triggered when we reach the bottom of the buffer, and the row coordinates are cycled. In Conhost we need to trigger an accessibility scroll event, and in Windows Terminal we need to update selection and marker offsets, reset pattern intervals, and preserve the user's scroll offset. This is now handled by a new `NotifyBufferRotation` method in `ITerminalApi`. But this made me realise that the `_EraseAll` method should have been doing the same thing when it reached the bottom of the buffer. So I've added a call to the new `NotifyBufferRotation` API from there as well. And in the case of Windows Terminal, the scroll offset preservation was something that was also needed for a regular viewport pan. So I've put that in a separate `_PreserveUserScrollOffset` method which is called from the `SetViewportPosition` handler as well. ## Validation Steps Performed Because of the API changes, there were a number of unit tests that needed to be updated: - Some of the `ScreenBufferTests` were accessing margin state in the `SCREEN_INFORMATION` class which doesn't exist anymore, so I had to add a little helper function which now manually detects the active margins. - Some of the `AdapterTest` tests were dependent on APIs that no longer exist, so they needed to be rewritten so they now check the resulting state rather than expecting a mock API call. - The `ScrollWithMargins` test in `ConptyRoundtripTests` was testing functionality that didn't previously work correctly (issue #3673). Now that it's been fixed, that test needed to be updated accordingly. Other than getting the unit tests working, I've manually verified that issue #3673 is now fixed. And I've also checked that the scroll markers, selections, and user scroll offset are all being updated correctly, both with a regular viewport pan, as well as when overrunning the buffer. Closes #3673
Hi... It doesn't seem to have happened? I head the idea to make headers on some scripts only to find out that doing so made me lose all the output in the scrollback. (Alternate buffer isn't what I want either.) |
@ClaireCJS It sounds like you're trying to set a scroll region starting from line 2, e.g. if your screen height is 24, I'm guessing you're setting the scroll region to something like The scenario we were trying to fix here was a scroll region like |
You did ascertain correctly what I was doing. So there's just no way to do that? To me, everything should just scroll past the locked part. This kinda destroys my concept of having headers at the top describing what is being done. Of course the tab title exists but that's not nearly as pretty (wish i could change its color to indicate status). Though if i'm hearing you right — the idea would work at the BOTTOM of the screen, but ONLy with the last row, not with any more rows? Basically, i just wanted to make a pretty 3 (or 4) line header at top saying what was happening, that looks like this: Is that even possible at the bottom, or am I restricted to just 1 line, not 3 like i used here? |
@ClaireCJS I'm afraid that's not how margins work. You might be able to achieve something like that manually, if you're controlling the scrolling yourself, but you wouldn't be able to run a random application or shell within the margin area and just expect it to work. If you want more info on how that could be achieved, it would probably be best to continue this conversation in the discussions area. I think we've strayed quite far off topic here.
You can lock as many rows as you want at the bottom of the screen. The only requirement is that the first row of the margin area is at the top of the screen, i.e. there can be no gap between the area you are scrolling and the scrollback buffer if you want the content to be pushed into the scrollback. |
Environment
Windows Terminal version: Version: 0.6.2951.0
Microsoft Windows [Version 10.0.18362.418]
Steps to reproduce
Expected behavior
If I scroll up, I should be able to see the serial console messages from my embedded target.
Actual behavior
Scroll up shows my command that I typed long ago. The serial console message is lost. If I run Ubuntu terminal directly (instead of doing the same from Windows Terminal), I could scroll up and see right messages.
Not sure, may be ncurses behavior is not compatible with Windows Terminal's expectations?
The text was updated successfully, but these errors were encountered: