minimal augment of `handleSelectedRangesChanged()`: clip userland specif...

...ied ranges both left & right + use the standard (fastest) `for (i = ..., len = ..., i < len; i++){...}` idiom