Each time I implement form logic, I learn a few new tricks, I've always been a bit scared of handling negative length selection(when selection-to, is before the selection-from). Turns out there's not much to it beyond making helper functions that returns the range and flips thing when they're negative.
@neauoire Nice! What do you think about selecting everything between two parantheses by double clicking on one of them?