     @editor.on(Scribe.Editor.events.USER_TEXT_CHANGE, (delta) =>
       return if @ignoringChanges
       this.record(delta, oldDelta)
-      oldDelta = delta
+      oldDelta = @editor.getDelta()
     )
 
   record: (changeDelta, oldDelta) ->
     return if changeDelta.isIdentity(changeDelta)
     @redoStack = []
-    undoDelta = Scribe.UndoManager.computeUndo(changeDelta, oldDelta)
+    undoDelta = oldDelta.invert(changeDelta)
     timestamp = new Date().getTime()
     ###
     if @lastRecorded + @options.delay > timestamp and @undoStack.length > 0

    if @undoStack.length > 0
      change = @undoStack.pop()
      _ignoreChanges.call(this, =>
        console.log 'undoing'
        @editor.applyDelta(change.undo, { source: 'user' })
        index = getLastChangeIndex(change.undo)
        @editor.setSelection(new Scribe.Range(@editor, index, index))

  @DEFAULTS:
    delay: 1000


  constructor: (@editor, options = {}) ->
    @undoStack = []
