-
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
ConPTY should less aggressively reprint the screen #919
Comments
This should also improve performance as it would avoid clearing out all the rows which happens a lot right now. |
Do we have a particular repro case where the screen is repainted when we don't expect it to be? For the record, conpty already only repaints the regions it believes have changed in the course of a frame. Most of the code is in this directory - with invalidate.cpp and paint.cpp probably being the most interesting. The There was some bug in either RS5 or in-between RS5 and 19H1 where we'd incorrectly repaint the screen whenever the active attributes were changed (which is pretty constantly). I believe that's fixed now, so this shouldn't be as bad as before, but it could always be better. Concrete scenarios would certainly make this easier to drill into. In the linked scenario, it almost seems like the task is spawning a new conpty instance to run the task, and then writing that output to the parent, is that correct? If that's the case then maybe the child task needs to inherit the cursor position of the parent terminal (using |
@zadjii-msft the flow in microsoft/vscode#74063 is roughly:
@alexr00 what's your Windows 10 build number? |
Yea that sounds exactly like the kind of situation where Since conpty has to maintain the state of a console buffer, by default it assumes that the buffer is empty. However, with I believe WSL and ssh.exe both use this flag, to make console sessions more continuous. Otherwise, as you've noted, we'll start by clearing the screen, which is only really desirable if you know you're starting from a fresh terminal window. |
What's the problem you're trying to fix by not assuming a cursor position of 1,1 when conpty starts? |
We are assuming a cursor position of The reason we by default assume a cursor position of To support these APIs from a pseudoconsole, we had to do two things. First and foremost, we can't lie to a Win32 console application about where the cursor is, or where any output has been drawn. That would force us to pile up hacks to adjust the location of every buffer- or cursor position-related call. So, we assume the cursor is at Because there is no "API" for requesting the cursor position apart from requesting The second thing we do is to ensure that the win32 console and its VT representation are in sync (that is: a console application reading a buffer out of the console won't see blank space where the terminal says there's text, and vice-versa): we clear the screen. This only applies when we home the cursor to TL;DR: We home the cursor to Double TL;DR: The premise for your question didn't make sense, so I decided it would be best to just explain everything. |
Thanks it sounds like we should just default to |
Tasks in VS Code listens to terminal output to detect diagnostics (errors/warnings) and when watch tasks start and end. It also writes to the terminal itself some status messages such as:
Because of the way ConPTY reprints the screen frequently, this causes problems with this though as it will replace the terminal-side messages like the "Executing task" message and will also report diagnostics multiple times (which I think we de-dupe but could potentially cause issues).
It would be better if ConPTY kept track of when only new output was printed at the cursor and only reprinted when absolutely necessary like on a resize. This would bring it much closer in line to how winpty and nix ptys work.
VS Code issue: microsoft/vscode#74063
The text was updated successfully, but these errors were encountered: