class RTUI::Progress

def show

def show
  line = @components.map {|method|
    send(sprintf("fmt_%s", method))
  }.join " "
  width = TTY.get_width
  if line.length == width - 1
    @out.print(line + eol)
    @out.flush
  elsif line.length >= width
    @terminal_width = [@terminal_width - (line.length - width + 1), 0].max
    if @terminal_width == 0 then @out.print(line + eol) else show end
  else # line.length < width - 1
    @terminal_width += width - line.length + 1
    show
  end
  @previous_time = Time.now
end