-
Notifications
You must be signed in to change notification settings - Fork 305
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
Using CSI # S to scroll screen buffer is incorrect and can lead to data loss #724
Comments
In your scenario, I think the call is here. v1.2 was calling I don't think any of the scrollback buffer is being destroyed (barring bugs) other than the part that needs to be scrolled off the screen because the buffer is full. As for performance - is it worse than calling |
Wait, why were you ever calling that API? In this case, aren't you effectively just newlining down from the previous output? Why would you need to call Plus, this might be getting hit more frequently (esp on *nix) where there's no "screen buffer", there's only the viewport. So the cursor is going to be hitting the bottom of the "buffer" after only ~30 lines (the height of your window) instead of after 9000 lines. As far as "destroy the user's scrollback buffer", what we mean can be easily repro'd with the following VT sequence. You can test this out from bash with the following commandline: printf "\033[2J\033[HThis line of text will disappear\n1\n2\n3\n4\n5\n6\n7\n8\015\033[1S" This string:
You can see the output here: If you scroll up into the terminal's history, you'll see that the line "This line of text will disappear" does not appear in the scrollback. While this example is trivial, in the real world case, this means that if you hit enter a couple of times at the prompt line after outputting a bunch of text, the history gets deleted instead of moving into the scrollback. |
My memory is definitely hazy here, but I think I needed IIRC, when the cursor was at the end of the line, writing a newline had no effect. I think the behavior had also changed between Windows versions, but I don't recall specifics. |
@MVKozlov - are you sure? I think that issue is unrelated. |
I doesn't look in |
Ah, I see, thanks for the clarification, and sorry I haven't gotten around to fixing your issue. |
This hopefully fixes some weird issues in WSL and some Linux terminals. This also works around a Windows 1809 Console bug for the Ctrl+l binding to clear the screen by using the same escape sequence that bash uses. Fix #724
This fixes some weird issues in WSL and some Linux terminals. This also works around a Windows 1809 Console bug for the Ctrl+l binding to clear the screen by using the same escape sequence that bash uses. Fix #724
Environment data
Steps to reproduce or exception report
Make sure that the prompt is at the bottom of the screen, then press enter any number of times. One should do.
PSReadline will emit
^[[1S
(from ConsoleLib.cs, perhaps via ReadLine.cs).Scrolling the viewport in this manner can:
cc @zadjii-msft
The text was updated successfully, but these errors were encountered: