Split marked ranges into mulitple lines before removing formatting

This should be replaced with CodeMirror's detachLine once that is
implemented if possible