Clean up TextEditor::pasteText

Just some cleanup.