Merge pull request #15831 from atom/b3-failing-seed

Handle edits that scroll up due to hiding the horizontal scrollbar
This commit is contained in:
Nathan Sobo
2018-02-15 14:32:20 -08:00
committed by GitHub
2 changed files with 61 additions and 9 deletions

View File

@@ -266,14 +266,22 @@ class TextEditorComponent {
if (useScheduler === true) {
const scheduler = etch.getScheduler()
scheduler.readDocument(() => {
this.measureContentDuringUpdateSync()
const restartFrame = this.measureContentDuringUpdateSync()
scheduler.updateDocument(() => {
this.updateSyncAfterMeasuringContent()
if (restartFrame) {
this.updateSync(true)
} else {
this.updateSyncAfterMeasuringContent()
}
})
})
} else {
this.measureContentDuringUpdateSync()
this.updateSyncAfterMeasuringContent()
const restartFrame = this.measureContentDuringUpdateSync()
if (restartFrame) {
this.updateSync(false)
} else {
this.updateSyncAfterMeasuringContent()
}
}
this.updateScheduled = false
@@ -391,15 +399,16 @@ class TextEditorComponent {
this.measureHorizontalPositions()
this.updateAbsolutePositionedDecorations()
const isHorizontalScrollbarVisible = (
this.canScrollHorizontally() &&
this.getHorizontalScrollbarHeight() > 0
)
if (this.pendingAutoscroll) {
this.derivedDimensionsCache = {}
const {screenRange, options} = this.pendingAutoscroll
this.autoscrollHorizontally(screenRange, options)
const isHorizontalScrollbarVisible = (
this.canScrollHorizontally() &&
this.getHorizontalScrollbarHeight() > 0
)
if (!wasHorizontalScrollbarVisible && isHorizontalScrollbarVisible) {
this.autoscrollVertically(screenRange, options)
}
@@ -408,6 +417,8 @@ class TextEditorComponent {
this.linesToMeasure.clear()
this.measuredContent = true
return wasHorizontalScrollbarVisible !== isHorizontalScrollbarVisible
}
updateSyncAfterMeasuringContent () {