           # put it back in the main tree.
           if @cursor.document is i + 1
             @setCursor @tree.start
+
+          if @cursor.document > i + 1
+            @cursor.document -= 1
 
           @floatingBlocks.splice i, 1
           break

    @mainCtx.globalAlpha *= FLOATING_BLOCK_ALPHA
    for record in @floatingBlocks
      blockView = @view.getViewNodeFor record.block
      blockView.layout record.position.x, record.position.y
      blockView.draw @mainCtx, rect, {
        grayscale: false
        selected: false

    @clearDrag()
    @redrawMain()
    @redrawHighlights()

hook 'mousedown', 0.5, (point, event, state) ->
  # If someone else has already taken this click, pass.
  if state.consumedHitTest then return

  # If it's not in the main pane, pass.
  if not @trackerPointIsInMain(point) then return

  # Hit test against floating blocks
  for record, i in @floatingBlocks
    if record.cachedGrayBoxPath? and record.cachedGrayBoxPath.contains @trackerPointToMain point
      @clickedBlock = new model.List record.block.start.next, record.block.end.prev
      @clickedPoint = point

      @view.getViewNodeFor(@clickedBlock).absorbCache()

      state.consumedHitTest = true

      @redrawMain()

Editor::performFloatingOperation = (op, direction) ->
  if (op.type is 'create') is (direction is 'forward')
