Skip to content
This repository was archived by the owner on Mar 3, 2023. It is now read-only.

Handle edits that scroll up due to hiding the horizontal scrollbar - #15831

Merged
nathansobo merged 12 commits into
masterfrom
b3-failing-seed
Feb 15, 2018
Merged

nathansobo merged 12 commits into
masterfrom
b3-failing-seed

Conversation

@Ben3eeE

@Ben3eeE Ben3eeE commented Oct 5, 2017 •

Copy link
Copy Markdown
Contributor

TODO


Before:
before safe mode

After:
after dev mode

Fixes #16289
Fixes #16722
Fixes #16710
Fixes #15263

Updating the soft wrap column could cause us to compute different values
for derived dimensions, so any dimensions that were cached *in the
process* of updating the soft wrap column need to be cleared.
@Ben3eeE

Ben3eeE commented Oct 6, 2017

Copy link
Copy Markdown
Contributor Author

@as-cii @nathansobo appveyor is getting the same failure that I saw locally.

@Ben3eeE Ben3eeE changed the title WIP failing seed Handle edits that scroll up due to hiding the horizontal scrollbar Oct 19, 2017
@Ben3eeE

Ben3eeE commented Oct 19, 2017 •

Copy link
Copy Markdown
Contributor Author

@as-cii I paired with @nathansobo on this. Can you take a look at our proposed change when you have time? 👀

Setup:
We have an editor that is 1 line tall and the scrollbar and line height are both 17 so the scrollbar is obscuring the entire editor. We are scrolled down exactly one line.

We then delete all content except the first character of the file which causes an update.
Now when the updateSyncBeforeMeasuringContent runs we are still believing that we can scroll vertically because we don't detect the hiding of the horizontal scrollbar until measureContentDuringUpdateSync. It's based on the longest line which is done after the updateSyncBeforeMeasuringContent function.

Our proposed change is to restart the frame in scenarios where the scrollbar visibility changes during the update. Maybe you have some other idea on how we could solve this? You can ask me in Slack if this doesn't make sense, explaining is hard 😆

We still need to change the spec to style the scrollbars so it's failing on other platforms and probably rebase and clean up the git history.

@nathansobo

Copy link
Copy Markdown
Contributor

@Ben3eeE Hope you don't mind. I made a small clarifying edit to the body of this PR.

Comment thread spec/text-editor-component-spec.js Outdated
component.scheduleUpdate()
await component.getNextUpdatePromise()

editor.setSelectedBufferRange(new Range(Point(0,1),Point(12,2)))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's fine to express a range as nested arrays like [[0, 1], [12, 2]], especially in tests.

const restartFrame = this.measureContentDuringUpdateSync()
scheduler.updateDocument(() => {
this.updateSyncAfterMeasuringContent()
if (restartFrame) {

@nathansobo nathansobo Oct 20, 2017 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We probably should support this same behavior on the non-scheduled code path as well, which is in the else branch of the useScheduler === true branch.

// rendered start row accurately. 😥
this.populateVisibleRowRange(renderedStartRow)
this.props.model.setEditorWidthInChars(this.getScrollContainerClientWidthInBaseCharacters())
this.derivedDimensionsCache = {}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did this fix some other failing seed or something?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is cherry-picked from your PR which was not yet merged when this was opened #15828 just to verify that PR wouldn't fix this failure.

@nathansobo

Copy link
Copy Markdown
Contributor

@Ben3eeE Maybe rebase this on the latest master? I feel like that autocomplete failure on Circle might be fixed in newer versions. Could be wrong.

@Ben3eeE

Ben3eeE commented Oct 20, 2017 •

Copy link
Copy Markdown
Contributor Author

@nathansobo Yeah that failure is something Justin has already fixed. We should definitely rebase this.

As a side note edit: I'm not really sure how to rebase this and I'm going to be away for a couple of days. If someone wants to get this merged before then please feel free to rebase and address the review comments.

@as-cii

as-cii commented Nov 9, 2017

Copy link
Copy Markdown
Contributor

What's the status of this? Should we go ahead and merge it? It looks reasonable, although seems like tests are failing.

@Ben3eeE

Ben3eeE commented Nov 9, 2017

Copy link
Copy Markdown
Contributor Author

What's the status of this? Should we go ahead and merge it? It looks reasonable, although seems like tests are failing.

We need to address the review feedback by @nathansobo and style the scrollbars in the test to be the same size as the lineHeight so it's consistently failing on all platforms. It was only failing on appveyor because both the scrollbar and lineHeight was both 17 or something.

The failing test was on master when this PR was created and has already been fixed and everything should be green if we rebase with master.

I won't have time to work on these things anytime soon and will be away for quite a while starting today 🌴

@Ben3eeE

Ben3eeE commented Jan 19, 2018

Copy link
Copy Markdown
Contributor Author

Addressed the review comments by @nathansobo and edited the body of the PR to reflect the current status of this PR.

@Ben3eeE Ben3eeE changed the title Handle edits that scroll up due to hiding the horizontal scrollbar [WIP] Handle edits that scroll up due to hiding the horizontal scrollbar Feb 15, 2018
@Ben3eeE Ben3eeE changed the title [WIP] Handle edits that scroll up due to hiding the horizontal scrollbar Handle edits that scroll up due to hiding the horizontal scrollbar Feb 15, 2018
@nathansobo

Copy link
Copy Markdown
Contributor

This fixes some serious known issues but @Ben3eeE is having trouble coming up with a regression test that works on all platforms. In the interest of not delaying further, I'm going to merge this now and @Ben3eeE is going to follow up with another attempt at a regression test, possibly based on hard coding a failing seed in addition to the randomly generated ones in our randomized test.

@nathansobo
nathansobo merged commit f647109 into master Feb 15, 2018
@nathansobo
nathansobo deleted the b3-failing-seed branch February 15, 2018 22:32
@nathansobo

Copy link
Copy Markdown
Contributor

Thanks @Ben3eeE. I feel honored to work with you and am truly thankful for all that you contribute. ❤️ ⚡

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

4 participants