implemented the delete branch command

bugfixes:
  - copy range and move range now work when selecting the start and end in
    reverse order.
  - trying to move or copy a document to the same window as the window it
    is already in now raises an error