-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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 not handled correctly #14622
Comments
Thanks for the detailed report. The scroll margin thing is a known problem (see issue #3673). We just don't have a way to propagate that state over the conpty connection at this point in time. In the long term it could be solved by the passthrough mode (#1173).
This bit I'm not so sure about. But if the |
Thanks. That's clear. The BufferHeight property in the .NET Console class does not resize the window. It simply sets the buffer height, presumably using SetConsoleScreenBufferInfoEx() and the dwSize field in the CONSOLE_SCREEN_BUFFER_INFO_EX struct (on Windows). There are separate properties for getting or setting the console window dimensions, and also a SetWindowSize() method for resizing the window, presumably using SetConsoleWindowInfo(). These properties and methods are very sensitive, of course, to the OS platform, and are only fully supported on Windows. Setting the BufferHeight property, for example (as used in the example code) is only supported on Windows, while getting the BufferHeight value is supported on Linux and FreeBSD, but not on iOS or Android. |
Thanks for the detailed writeup! I'd agree with the assesment that this seems to be a /dupe of #3673. Let's call it that until proven otherwise. Thanks! |
Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report! |
When a VT100 ‘r’ code is used to create a scroll region in the console window, as lines scroll off the top of the window, their content is lost and the displayed lines may be repeated and printed in an incorrect order. The same code works as expected in old command console, but the issue occurs in Windows Terminal from both PowerShell and Command Prompts.
To reproduce, I’ve create a basic C# console application. The code ensures that VT100 support is switched on (it is off by default when using the old command console). It sets the buffer height to an appropriate value. It then creates a status line in the last line of the console window and sets the rest of the window area as a scrollable region (ESC[0;28r). Then, having set the cursor to the top left of the window, it prints out 50 lines.
If the code is run under the old command console, all is well. When you scroll up, the lines that have scrolled off the screen are visible. However, the same code (compiled binary) does not work correctly under Windows Terminal. The output is garbled with some lines repeated, and displayed out of order. The behaviour of the code can be improved by adding a delay (100ms sleep) after each line is output. This slows the code down significantly, but the lines are at least output in the correct order. However, when you scroll up, the lines that have scrolled off the screen are empty.
NB., if you build a debug build under Visual Studio, it will probably run a bit better (less garbled) than a release build.
I’m using version 1.15.3466.0 of Windows Terminal on version 21H2 of Windows 11 Pro (22000.1335). I have not upgraded yet to 22H2 due to an unresolved boot issue under that version on my laptop. I have compiled the code under both .NET 6 and .NET 7.
Here is the source code:
ConsoleScrollingExample.zip
The text was updated successfully, but these errors were encountered: