Repository navigation
keep fold arrow clicks from being ignored after a tokenizer update - #19849
Open
kevinushey wants to merge 1 commit into
Open
kevinushey wants to merge 1 commit into
kevinushey wants to merge 1 commit into
Conversation
Ace's gutter click handler reads the session's fold widget cache, which a tokenizer update empties until the gutter next renders; a click in between was dropped. A capturing gutterclick listener now fills in the clicked row's entry first. Addresses #19848
RStudio E2E - all platforms1 test(s) failed
All platforms - commit |
This branch has not been deployed
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.
Fixes #19848.
Intent
A click on a fold arrow in the editor gutter was ignored when it landed between a run of Ace's background tokenizer (about 700ms after a document's text or mode is set) and the gutter's next render.
git_diff_gutter.test.ts"keeps a fold of added lines when its parent is expanded from the base pane" failed this way now and then.Approach
Ace caches each row's fold widget in
session.foldWidgets; atokenizerUpdateempties the cache and the gutter refills it as it renders. Ace'sgutterclickhandler reads the cache without filling it in, so in between the row appears to have no widget.A new acesupport mixin (
acemixins/fold_widget_click.js) registers a capturinggutterclicklistener on each new editor, which fills in the entry for the clicked row before Ace's handler reads it. No change to the Ace fork; the mixin can go once Ace fixes its handler (ajaxorg/ace#6035).The click retry in the test's
expandInBasehelper worked around the same thing and is removed, so that the test fails if the fix stops working.Automated Tests
code-folding.test.ts: fires the tokenizer's update and a click on a fold arrow in one task; fails without the mixin.git_diff_gutter.test.ts: passes with plain clicks.QA Notes
Covered by the automated tests; the window is one animation frame, so it cannot be hit reliably by hand.
Documentation
None.
Checklist
NEWS.md