replaceRange

fun replaceRange(range: SelectionRange, which: Int = mainIndex): EditorSelection

Replace a given range with another range, and then normalize the selection to merge and sort ranges if necessary.