       head.remove()
       head = next
 
-    # Update the ace editor value to match,
-    # but don't trigger a resize event.
-    @suppressChangeEvent = true; oldScroll = @aceEditor.session.getScrollTop()
-    @aceEditor.setValue @getValue(), -1
-    @suppressChangeEvent = false; @aceEditor.session.setScrollTop oldScroll
-
     # If someone has bound to mutation via
     # the public API, fire it.
-    @fireEvent 'change', [operation]
+    @fireEvent 'beforechange', [operation]
 
   # The undo function pops and undoes
   # operations from the undo stack until

  # fields a populate time
  hook 'populate', 0, ->
    @undoStack = []

  # The UndoOperation class is the base
  # class for all undo operations.


  Editor::redrawMain = (opts = {}) ->
    unless @currentlyAnimating

      if @changeEventVersion isnt @tree.version
        # Update the ace editor value to match,
        # but don't trigger a resize event.
        @suppressChangeEvent = true; oldScroll = @aceEditor.session.getScrollTop()
        @aceEditor.setValue @getValue(), -1
        @suppressChangeEvent = false; @aceEditor.session.setScrollTop oldScroll

        @fireEvent 'change', []

        @changeEventVersion = @tree.version

      # Set our draw tool's font size
      # to the font size we want
      @draw.setGlobalFontSize @fontSize
