Throttle keyboard pane resize to avoid UI stalls - #20563
Open
zhangxaochen wants to merge 2 commits into
Open
Conversation
Key auto-repeat can fire resizePane faster than XAML and every terminal under the splitter can reflow. Keep accepting the new split percentage, but apply the grid at an interval that tracks recent layout cost, and cap per-apply movement so a UI stall cannot jump the splitter across the window. Fixes microsoft#20562 Co-authored-by: Cursor <cursoragent@cursor.com>
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
This comment has been minimized.
This comment has been minimized.
Author
|
@microsoft-github-policy-service agree |
Reword "relayout" / "cooldown" so the spelling bot is happy without adding project dictionary entries for two comments. Co-authored-by: Cursor <cursoragent@cursor.com>
4 tasks
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 of the Pull Request
Keyboard
resizePane(holdAlt+Shift+Left/Right) no longer queues a XAML + terminal reflow on every auto-repeat tick. The latest split percentage is always accepted; the grid is applied at a rate that tracks recent layout cost, and each apply is capped so a UI stall cannot jump the splitter across the window.Closes #20562.
References and Relevant Issues
Detailed Description of the Pull Request / Additional comments
Pane::_Resizeused to call_CreateRowColDefinitions()on every key-repeat (~30 Hz). That rebuilds the Grid row/column definitions and reflows every terminal under the splitter. With 4 panes the layout cost exceeds one key-repeat period, so the UI thread queues more work than it can finish: hitching, occasional half-window jumps after a stall, and in Debug an ANR.This change:
_desiredSplitPositionso a held key still progresses._splitLayoutInterval(starts at 125 ms, then an EMA of2 × measured layout cost, clamped to 32–250 ms). At most oneDispatcherQueueTimeris in flight.Mouse drag / programmatic split size is unchanged — only the keyboard
_Resizepath is throttled.I intend to implement this (already validated locally). No settings/schema/docs changes.
Validation Steps Performed
CascadiaPackagex64 Release (WindowsTerminalDev).Alt+Shift+Left/Rightfor several seconds: splitter keeps moving, window stays responsive, no ANR.PR Checklist