         [ 0, text[3] ]
       else
         [ 1, text[1] + text[3] ]
-    lines = data.trim().split('\n')
+    lines = data.trim().split(/\r?\n/)
 
     justify = for cell in splitCells stripTailPipes formatline
       [first, ..., last] = cell.trim()

    )
    ( # body capture
      (?:
        (?:[^\n]*?\|[^\n]*)       # line w/ at least one pipe
        \ *                       # maybe trailing whitespace
        (?:\r?\n|$)               # newline
      )+ # at least one

          new Range(start, end)

    myIterator = (obj) =>
      editor.setTextInBufferRange(obj.range, @formatTable(obj.match))

    editor.getBuffer().transact =>
      for range in selectionsRanges
        editor.backwardsScanInBufferRange(@regex, range, myIterator)

  formatTable: (text) ->
    padding = (len, str = ' ') -> str.repeat Math.max len, 0
