 
 
   updateVerticalScrollState: ->
-    if @isInBatchMode()
+    if @isBatching()
       @shouldUpdateVerticalScrollState = true
-      @emitter.emit "did-update-state"
+      @needsRefresh()
     else
       @state.content.scrollHeight = @scrollHeight
       @state.gutter.scrollHeight = @scrollHeight

    @model.setVerticalScrollbarWidth(@measuredVerticalScrollbarWidth) if @measuredVerticalScrollbarWidth?
    @model.setHorizontalScrollbarHeight(@measuredHorizontalScrollbarHeight) if @measuredHorizontalScrollbarHeight?

  enterBatchMode: ->
    @batchMode = true

  exitBatchMode: ->
    @batchMode = false

  isInBatchMode: ->
    @batchMode == true

  applyChanges: ->
    @exitBatchMode()

    @updateContentDimensions() if @shouldUpdateContentDimensions
    @updateScrollbarDimensions() if @shouldUpdateScrollbarDimensions
    @updateStartRow() if @shouldUpdateStartRow
    @updateEndRow() if @shouldUpdateEndRow

    @updateFocusedState() if @shouldUpdateFocusedState
    @updateHeightState() if @shouldUpdateHeightState

      @state.hiddenInput.width = Math.max(width, 2)

  updateContentState: ->
    if @isBatching()
      @shouldUpdateContentState = true
      @needsRefresh()
    else
      @state.content.scrollWidth = @scrollWidth
      @state.content.scrollLeft = @scrollLeft
