     return
 
   @setCursor block.start, null, 'before'
+  @undoCapture()
   @spliceOut block
   @redrawMain()
 

      @tree.perform(operation, 'backward', [@cursor]) unless operation is 'CAPTURE'

  @popUndo()
  @redrawMain()
  return


  operation = null
  operation = @tree.insert location, node, [@cursor]
  @pushUndo operation
  @correctCursor()
  return operation

Editor::replace = (before, after, updates) ->
  operation = @tree.replace before, after, updates
  @pushUndo operation
  @correctCursor()
  return operation

Editor::correctCursor = ->
  cursor = @tree.getFromLocation(@cursor)
  unless @validCursorPosition cursor
    @setCursor cursor

Editor::prepareNode = (node, context) ->
  if node instanceof model.Container
