mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Don't re-measure if editor has become invisible
This commit is contained in:
committed by
Antonio Scandurra
parent
7aec696bb5
commit
6e6dce21ee
@@ -166,15 +166,23 @@ class TextEditorComponent {
|
||||
}
|
||||
|
||||
updateSync (useScheduler = false) {
|
||||
this.updateScheduled = false
|
||||
|
||||
// Don't proceed if we know we are not visible
|
||||
if (!this.visible) return
|
||||
|
||||
this.updateScheduled = false
|
||||
if (this.resolveNextUpdatePromise) this.resolveNextUpdatePromise()
|
||||
// Don't proceed if we have to pay for a measurement anyway and detect
|
||||
// that we are no longer visible.
|
||||
if ((this.remeasureCharacterDimensions || this.remeasureAllBlockDecorations) && !this.isVisible()) {
|
||||
if (this.resolveNextUpdatePromise) this.resolveNextUpdatePromise()
|
||||
return
|
||||
}
|
||||
|
||||
const onlyBlinkingCursors = this.nextUpdateOnlyBlinksCursors
|
||||
this.nextUpdateOnlyBlinksCursors = null
|
||||
if (onlyBlinkingCursors) {
|
||||
this.updateCursorBlinkSync()
|
||||
if (this.resolveNextUpdatePromise) this.resolveNextUpdatePromise()
|
||||
return
|
||||
}
|
||||
|
||||
@@ -202,6 +210,8 @@ class TextEditorComponent {
|
||||
this.measuredContent = true
|
||||
this.updateSyncAfterMeasuringContent()
|
||||
}
|
||||
|
||||
if (this.resolveNextUpdatePromise) this.resolveNextUpdatePromise()
|
||||
}
|
||||
|
||||
measureBlockDecorations () {
|
||||
|
||||
Reference in New Issue
Block a user