     @addMicroUndoOperation new SetValueOperation @tree, newParse
 
     @tree = newParse; @gutterVersion = -1
-    @tree.start.insert @cursor
+    @cursor = @tree.start
+
     @removeBlankLines()
     @redrawMain()
 

      # ## Document initialization
      # We start of with an empty document
      @tree = new model.Segment()
      @tree.start.insert @cursor

      @resize()


  # ================================

  hook 'populate', 0, ->
    @cursor = null

  # A cursor cannot be inside only a block.
  # Convenience function for this validation:
  Editor::isValidCursorPosition = (pos) ->
    return pos?.container is @tree or pos.parent.type in ['indent', 'segment']

  # A cursor is only allowed to be on a line.
  Editor::moveCursorTo = (destination, attemptReparse = false) ->
