mirror of
https://github.com/atom/atom.git
synced 2026-01-26 07:19:06 -05:00
Use null sentinel value for autoscrollTop to avoid bug with negatives
This commit is contained in:
committed by
Antonio Scandurra
parent
ec045d9333
commit
d929720d24
@@ -30,7 +30,7 @@ class TextEditorComponent {
|
||||
this.lineNodesByScreenLineId = new Map()
|
||||
this.textNodesByScreenLineId = new Map()
|
||||
this.pendingAutoscroll = null
|
||||
this.autoscrollTop = -1
|
||||
this.autoscrollTop = null
|
||||
this.scrollWidthOrHeightChanged = false
|
||||
this.previousScrollWidth = 0
|
||||
this.previousScrollHeight = 0
|
||||
@@ -89,9 +89,9 @@ class TextEditorComponent {
|
||||
this.horizontalPositionsToMeasure.clear()
|
||||
etch.updateSync(this)
|
||||
|
||||
if (this.autoscrollTop >= 0) {
|
||||
if (this.autoscrollTop != null) {
|
||||
this.refs.scroller.scrollTop = this.autoscrollTop
|
||||
this.autoscrollTop = -1
|
||||
this.autoscrollTop = null
|
||||
}
|
||||
if (measureLongestLine) {
|
||||
this.measureLongestLineWidth(longestLine)
|
||||
@@ -411,7 +411,6 @@ class TextEditorComponent {
|
||||
this.getRenderedEndRow() - 1,
|
||||
]
|
||||
})
|
||||
if (global.debug) debugger
|
||||
const lastCursorMarker = model.getLastCursor().getMarker()
|
||||
|
||||
this.cursorsToRender.length = cursorMarkers.length
|
||||
@@ -829,7 +828,7 @@ class TextEditorComponent {
|
||||
}
|
||||
|
||||
getScrollTop () {
|
||||
if (this.autoscrollTop >= 0) {
|
||||
if (this.autoscrollTop != null) {
|
||||
return this.autoscrollTop
|
||||
} else if (this.measurements != null) {
|
||||
return this.measurements.scrollTop
|
||||
|
||||
Reference in New Issue
Block a user