1 {Range} = require 'atom'
4 # Public: Determines if a string should be considered linewise or character
6 # text - The string to consider
8 # Returns 'linewise' if the string ends with a line return and 'character'
11 if text.lastIndexOf("\n") is text.length - 1
13 else if text.lastIndexOf("\r") is text.length - 1
18 # Public: return a union of two ranges, or simply the newRange if the oldRange is empty.
21 mergeRanges: (oldRange, newRange) ->
22 oldRange = Range.fromObject oldRange
23 newRange = Range.fromObject newRange
27 oldRange.union(newRange)