onSelection

Create an extension that calls callback with the current selection whenever the selection changes.

val session = rememberEditorSession(
doc = "Hello",
extensions = onSelection { selection -> println("Cursor at: ${selection.main.head}") }
)