class Optimist::Parser

def wrap_line(str, opts = {})

def wrap_line(str, opts = {})
  prefix = opts[:prefix] || 0
  width = opts[:width] || (self.width - 1)
  start = 0
  ret = []
  until start > str.length
    nextt =
    if start + width >= str.length
      str.length
    else
      x = str.rindex(/\s/, start + width)
      x = str.index(/\s/, start) if x && x < start
      x || str.length
    end
    ret << ((ret.empty? && !opts[:inner]) ? "" : " " * prefix) + str[start...nextt]
    start = nextt + 1
  end
  ret
end