mirror of
https://github.com/atom/atom.git
synced 2026-02-10 06:35:00 -05:00
Integrate properly with Atom scheduler
This commit is contained in:
committed by
Antonio Scandurra
parent
90452836fe
commit
fadde63ec4
@@ -105,17 +105,28 @@ class TextEditorComponent {
|
||||
} else if (!this.updateScheduled) {
|
||||
this.updateScheduled = true
|
||||
etch.getScheduler().updateDocument(() => {
|
||||
if (this.updateScheduled) this.updateSync()
|
||||
if (this.updateScheduled) this.updateSync(true)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
updateSync () {
|
||||
updateSync (useScheduler = false) {
|
||||
this.updateScheduled = false
|
||||
if (this.resolveNextUpdatePromise) this.resolveNextUpdatePromise()
|
||||
|
||||
this.updateSyncBeforeMeasuringContent()
|
||||
this.measureContentDuringUpdateSync()
|
||||
this.updateSyncAfterMeasuringContent()
|
||||
if (useScheduler === true) {
|
||||
const scheduler = etch.getScheduler()
|
||||
scheduler.readDocument(() => {
|
||||
this.measureContentDuringUpdateSync()
|
||||
scheduler.updateDocument(() => {
|
||||
this.updateSyncAfterMeasuringContent()
|
||||
})
|
||||
})
|
||||
} else {
|
||||
this.measureContentDuringUpdateSync()
|
||||
this.updateSyncAfterMeasuringContent()
|
||||
}
|
||||
}
|
||||
|
||||
updateSyncBeforeMeasuringContent () {
|
||||
|
||||
Reference in New Issue
Block a user