replaces the selection with text, or inserts it at the caret when nothing is selected; the caret moves after it