   union: (otherRange) ->
     start = if @start.isLessThan(otherRange.start) then @start else otherRange.start
     end = if @end.isGreaterThan(otherRange.end) then @end else otherRange.end
-    new Range(start, end)
+    new @constructor(start, end)
 
   isEmpty: ->
     @start.isEqual(@end)

class Range
  @fromObject: (object, copy) ->
    if Array.isArray(object)
      new Range(object...)
    else if object instanceof Range
      if copy then object.copy() else object
    else
      new Range(object.start, object.end)

  @fromPointWithDelta: (pointA, rowDelta, columnDelta) ->
    pointA = Point.fromObject(pointA)
    pointB = new Point(pointA.row + rowDelta, pointA.column + columnDelta)
    new Range(pointA, pointB)

  @fromText: (args...) ->
    if args.length > 1

      endPoint.column = lines[lastIndex].length
    else
      endPoint.column += lines[0].length
    new this(startPoint, endPoint)

  constructor: (pointA = new Point(0, 0), pointB = new Point(0, 0)) ->
    pointA = Point.fromObject(pointA)
