Selection.replaceContent

Replaces the content of the selection. If you replace it with an empty newText, it will delete the content.

If newText == "\b", it will delete the selection if it is non-empty, and otherwise delete the thing before the cursor.

If you want to do normal editor backspace key, you might want to check if(!selection.isEmpty()) selection.moveLeft(); before calling selection.deleteContent(). Similarly, for the delete key, you might use moveRight instead, since this function will do nothing for an empty selection by itself.

FIXME: what if i want to replace it with some multiply styled text? Could probably call it in sequence actually.

struct Selection
replaceContent

Meta