Repository navigation
Fix intermittent mouse selection failure in source editor - #16815
Merged
Merged
Conversation
Add automatic detection and recovery for corrupt Ace mouse handler state. When an uncaught JavaScript exception occurs during mouse event handling, the MouseHandler can be left in an inconsistent state where mouse selection stops working for that editor tab. This fix adds: - isMouseHandlerStateCorrupt(): detects suspicious state combinations - resetMouseHandlerState(): resets all mouse handler state variables - Automatic recovery check when editor tabs are activated Co-Authored-By: Claude Opus 4.5 <[email protected]>
Contributor
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
Member
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. 🤖 Generated with Claude Code |
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
Addresses #13436
Details
The root cause analysis suggests that Ace's MouseHandler can get stuck in a corrupt state when:
onCaptureEndbefore cleanup code runsinVirtualSelectionModeflag gets stucktruein multi-select scenariosstateproperty remains at a non-empty value like"select"or"drag"This PR adds two methods to
AceEditorNative:isMouseHandlerStateCorrupt()- detects suspicious state combinations (e.g., non-empty state when mouse is not pressed)resetMouseHandlerState()- resets all relevant state variables to their default valuesThe check runs in
AceEditorWidget.onActivate(), so whenever a user switches to a tab with corrupt state, it will be automatically recovered.Test plan
🤖 Generated with Claude Code