Repository navigation
Fix Pty::resizeWindow: use || instead of &&, and fix swapped assignment - #3718
Open
lijiajun325 wants to merge 2 commits into
Open
lijiajun325 wants to merge 2 commits into
lijiajun325 wants to merge 2 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Fixes two related bugs in
src/Pty/ConPty.cppandsrc/Pty/WinPty.cppthat together cause SSH sessions to be torn down whenever the WindTerm window is resized or the UI layout is rearranged.Closes #3717.
Bug Details
Bug 1 - Wrong logical operator (
&&should be||)ConPty.cpp:204andWinPty.cpp:170:The condition requires both dimensions to change simultaneously before any resize is sent to the underlying PTY. In practice, resizing by dragging one border only changes one dimension at a time, so the resize is silently dropped and the PTY keeps reporting the old size.
The Unix implementation (
UnixPty.cpp:223) already uses||, which confirms this was the intended logic.Bug 2 - Reversed assignment
ConPty.cpp:212-213:After a successful resize, the new dimensions are overwritten with the old member values, so the cached dimensions never advance. Combined with bug 1, this means almost every subsequent resize check fails and no further PTY updates are issued until both dimensions happen to change at the exact same moment.
WinPty.cpp:174-175correctly performsm_rows = rows; m_columns = columns;, so bug 2 only affects the ConPty path.Reproduction
Fix
Verification
A local build of WindTerm with these patches applied was verified to no longer disconnect on:
The local PTY and SSH channel stay in sync as the dimensions change.
Notes
A separate concern, observed during local testing, is that the bundled
winpty.dllaborts when called withcols <= 0 || rows <= 0. This seems to happen in the same scenarios (very small intermediate dimensions during layout transitions). That assertion lives inside the Microsoft winpty library and may warrant a separate issue / vendored patch.