mirror of
https://github.com/atom/atom.git
synced 2026-04-06 03:02:13 -04:00
Update DOM in screenPositionForPixelPosition if needed
Some packages are interacting with this method assuming this behavior, so this commit eliminates `screenPositionForPixelPositionSync` and instead just performs the DOM update in `screenPositionForPixelPosition` if it is needed.
This commit is contained in:
committed by
Antonio Scandurra
parent
001fef4a05
commit
fe13279531
@@ -173,22 +173,6 @@ class TextEditorComponent {
|
||||
return {top, left}
|
||||
}
|
||||
|
||||
screenPositionForPixelPositionSync (pixelPosition) {
|
||||
const {model} = this.props
|
||||
|
||||
const row = Math.max(0, Math.min(
|
||||
this.rowForPixelPosition(pixelPosition.top),
|
||||
model.getApproximateScreenLineCount() - 1
|
||||
))
|
||||
|
||||
if (!this.renderedScreenLineForRow(row)) {
|
||||
this.requestExtraLineToMeasure(row, model.screenLineForScreenRow(row))
|
||||
this.updateSyncBeforeMeasuringContent()
|
||||
this.measureContentDuringUpdateSync()
|
||||
}
|
||||
return this.screenPositionForPixelPosition(pixelPosition)
|
||||
}
|
||||
|
||||
scheduleUpdate (nextUpdateOnlyBlinksCursors = false) {
|
||||
if (!this.visible) return
|
||||
|
||||
@@ -2181,9 +2165,16 @@ class TextEditorComponent {
|
||||
model.getApproximateScreenLineCount() - 1
|
||||
)
|
||||
|
||||
let screenLine = this.renderedScreenLineForRow(row)
|
||||
if (!screenLine) {
|
||||
this.requestExtraLineToMeasure(row, model.screenLineForScreenRow(row))
|
||||
this.updateSyncBeforeMeasuringContent()
|
||||
this.measureContentDuringUpdateSync()
|
||||
screenLine = this.renderedScreenLineForRow(row)
|
||||
}
|
||||
|
||||
const linesClientLeft = this.refs.lineTiles.getBoundingClientRect().left
|
||||
const targetClientLeft = linesClientLeft + Math.max(0, left)
|
||||
const screenLine = this.renderedScreenLineForRow(row)
|
||||
const textNodes = this.textNodesByScreenLineId.get(screenLine.id)
|
||||
|
||||
let containingTextNodeIndex
|
||||
|
||||
Reference in New Issue
Block a user