ConPTY: Avoid WINDOW_BUFFER_SIZE_EVENT when the viewport moves #15935
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
SetConsoleWindowInfoImpl
callsPostUpdateWindowSize
, which emits aCM_SET_WINDOW_SIZE
event, which causes_InternalSetWindowSize
to becalled, which calls
ScreenBufferSizeChange
which then finally emits aWINDOW_BUFFER_SIZE_EVENT
event into the client input buffer.This messes up applications like which make use of
WINDOW_BUFFER_SIZE_EVENT
to perform potentially lossy operations.In case of SSH this results in a resize (SIGWINCH) of the server-side
screen which similarly may result in a response by the shell, etc.
Since that happens over networks and is async, and because our conhost
VT viewport implementation appears to have a number of subtle bugs,
this results in duplicate output lines (sometimes hundreds).
Under Windows Terminal this issue is not as apparent, since ConPTY has
no viewport that can be moved and no scrollback. It only appears as an
issue if a terminal application reacts poorly to the SIGWINCH event.
Closes #15769
Validation Steps Performed
SynthesizeWindowBufferSizeEvent
No calls to
SynthesizeWindowBufferSizeEvent
✅tput reset
Input line moves to row 0 ✅