     )
 
   undo: ->
-    if @undoStack.length > 0
-      change = @undoStack.pop()
-      _ignoreChanges.call(this, =>
-        @editor.applyDelta(change.undo, { source: 'user' })
-        index = getLastChangeIndex(change.undo)
-        @editor.setSelection(new Scribe.Range(@editor, index, index))
-      )
-      @redoStack.push(change)
+    _change.call(this, 'undo', 'redo')
 
 
 module.exports = Scribe

  if delta.endLength < delta.startLength + offset
    lastChangeIndex = delta.endLength
  return lastChangeIndex

_ignoreChanges = (fn) ->
  oldIgnoringChanges = @ignoringChanges

    )

  clear: ->
    @stack =
      undo: []
      redo: []
    @oldDelta = @editor.getDelta()

  record: (changeDelta, oldDelta) ->
