Repository: atom/atom
File: src/text-editor-component.js (JavaScript)

Code before:
      const originalBaseCharacterWidth = this.getBaseCharacterWidth()
      const scrollTopRow = this.getScrollTopRow()
      const scrollLeftColumn = this.getScrollLeftColumn()

      this.measureCharacterDimensions()
      this.measureGutterDimensions()
      this.queryLongestLine()

      if (this.getLineHeight() !== originalLineHeight) {
        this.setScrollTopRow(scrollTopRow)
      }
      if (this.getBaseCharacterWidth() !== originalBaseCharacterWidth) {
        this.setScrollLeftColumn(scrollLeftColumn)
      }
      this.remeasureCharacterDimensions = false
    }

    this.measureBlockDecorations()

    this.updateSyncBeforeMeasuringContent()
    if (useScheduler === true) {
      const scheduler = etch.getScheduler()
      scheduler.readDocument(() => {
        const restartFrame = this.measureContentDuringUpdateSync()
        scheduler.updateDocument(() => {
          if (restartFrame) {
            this.updateSync(true)
          } else {
            this.updateSyncAfterMeasuringContent()
          }
        })
      })
    } else {
      this.measureContentDuringUpdateSync()
      this.updateSyncAfterMeasuringContent()
    }

    this.updateScheduled = false
  }

  measureBlockDecorations () {
    if (this.remeasureAllBlockDecorations) {
      this.remeasureAllBlockDecorations = false

      const decorations = this.props.model.getDecorations()
      for (var i = 0; i < decorations.length; i++) {
        const decoration = decorations[i]
        const marker = decoration.getMarker()
        if (marker.isValid() && decoration.getProperties().type === 'block') {
          this.blockDecorationsToMeasure.add(decoration)
        }

Review comment (suggestion):
We probably should support this same behavior on the non-scheduled code path as well, which is in the else branch of the `useScheduler === true` branch.

Code after:
      const originalBaseCharacterWidth = this.getBaseCharacterWidth()
      const scrollTopRow = this.getScrollTopRow()
      const scrollLeftColumn = this.getScrollLeftColumn()

      this.measureCharacterDimensions()
      this.measureGutterDimensions()
      this.queryLongestLine()

      if (this.getLineHeight() !== originalLineHeight) {
        this.setScrollTopRow(scrollTopRow)
      }
      if (this.getBaseCharacterWidth() !== originalBaseCharacterWidth) {
        this.setScrollLeftColumn(scrollLeftColumn)
      }
      this.remeasureCharacterDimensions = false
    }

    this.measureBlockDecorations()

    this.updateSyncBeforeMeasuringContent()
    if (useScheduler === true) {
      const scheduler = etch.getScheduler()
      scheduler.readDocument(() => {
        const restartFrame = this.measureContentDuringUpdateSync()
        scheduler.updateDocument(() => {
          if (restartFrame) {
            this.updateSync(true)
          } else {
            this.updateSyncAfterMeasuringContent()
          }
        })
      })
    } else {
      const restartFrame = this.measureContentDuringUpdateSync()
      if (restartFrame) {
        this.updateSync(false)
      } else {
        this.updateSyncAfterMeasuringContent()
      }
    }

    this.updateScheduled = false
  }

  measureBlockDecorations () {
    if (this.remeasureAllBlockDecorations) {
      this.remeasureAllBlockDecorations = false

      const decorations = this.props.model.getDecorations()
      for (var i = 0; i < decorations.length; i++) {
        const decoration = decorations[i]