mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
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:
@@ -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 () {
|
||||
|
||||
Reference in New Issue
Block a user