This repository was archived by the owner on Mar 3, 2023. It is now read-only.
Repository navigation
Fix measuring lines in presence of pending autoscroll requests - #15270
Merged
Merged
Conversation
Calling `pixelPositionForScreenPosition` was sometimes throwing an error indicating that the requested position was not rendered and that, as such, could not be measured. This was caused by trying to measure a line that was visible at the moment of the call while also having a pending autoscroll request that would cause that line to go off-screen. Due to how the code was structured, we would mistakenly detect that line as visible, autoscroll to a different location, re-render a different region of the buffer and then try to measure the now invisible line. This commit fixes this issue by restructuring and simplifying the logic for rendering extra lines in order to measure them. Now, every line for which a measurement has been requested is stored in a `linesToMeasure` map. During the first phase of the update process (after honoring autoscroll requests), we detect which of these lines are currently visible and if they're not, store them into the `extraRenderedScreenLines` map, which is then used to render lines that are invisible but need to be measured.
Contributor
|
@as-cii I tested both to scroll while alternating holding page up and page down and to scroll by pasting text and it looks good to me. I am unable to reproduce the issue after this pull-request. |
Contributor
|
Awesome work @as-cii! |
nathansobo
pushed a commit
that referenced
this pull request
Aug 12, 2017
Fix measuring lines in presence of pending autoscroll requests
nathansobo
pushed a commit
that referenced
this pull request
Aug 12, 2017
Fix measuring lines in presence of pending autoscroll requests
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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 #15168.
Calling
pixelPositionForScreenPositionwas sometimes throwing an error indicating that the requested position was not rendered and that, as such, could not be measured.This was caused by trying to measure a line that was visible at the moment of the call while also having a pending autoscroll request that would cause that line to go off-screen. Due to how the code was structured, we would mistakenly detect that line as visible, autoscroll to a different location, re-render a different region of the buffer and then try to measure the now invisible line.
This commit fixes this issue by restructuring and simplifying the logic for rendering invisible lines in order to measure them. Now, every line for which a measurement has been requested is stored in a
linesToMeasuremap. During the first phase of the update process (after honoring autoscroll requests), we detect which of these lines are currently visible and if some of them are not, we store them into theextraRenderedScreenLinesmap, which is then used to render lines that are invisible but need measurement.@Ben3eeE @ungb: I am unable to reproduce the issue after this pull-request. Can you help me ensure this fixes all the reports we've got for this issue so far? They seem to be generated by slightly different reproduction steps, although I think they can all be traced back to the root cause described above.
/cc: @nathansobo for 👀