Replaces the current selection with given text.
When no text is selected the text will be inserted at the cursor position.