+
+ # Public: return a union of two ranges, or simply the newRange if the oldRange is empty.
+ #
+ # Returns a Range
+ mergeRanges: (oldRange, newRange) ->
+ oldRange = Range.fromObject oldRange
+ newRange = Range.fromObject newRange
+ if oldRange.isEmpty()
+ newRange
+ else
+ oldRange.union(newRange)