Is there a clean, established way to create multiple selections and/or a selection with multiple, discontinuous ranges?
I notice that Selection
contains a ranges
array, but I don’t see any constructors or static helper methods for creating multiple ranges.
Perhaps the right way to do this would be to extend Selection
with a new class that accepts multiple start/end positions—something like MultiNodeSelection
or DiscontinuousTextSelection
. If I were to do so, do all commands respect the Selection.ranges
array when appropriate? Or do some simply use the anchor
/head
or from
/to
positions directly?