rdoc/stats/normal.rb: clear previous output

* lib/rdoc/stats/normal.rb (print_file): clear previous output
  instead of filling the line, not to leave extra spaces.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46709 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2014-07-06 01:00:29 +00:00
Родитель 31cd6420a1
Коммит 25e8f524f2
1 изменённых файлов: 4 добавлений и 3 удалений

Просмотреть файл

@ -6,6 +6,7 @@ class RDoc::Stats::Normal < RDoc::Stats::Quiet
def begin_adding # :nodoc:
puts "Parsing sources..."
@last_width = 0
end
##
@ -30,10 +31,10 @@ class RDoc::Stats::Normal < RDoc::Stats::Quiet
line = "#{progress_bar}#{filename}"
if $stdout.tty?
# Pad the line with whitespaces so that leftover output from the
# Clean the line with whitespaces so that leftover output from the
# previous line doesn't show up.
padding = terminal_width - line.size
line << (" " * padding) if padding > 0
$stdout.print("\r" << (" " * @last_width) << ("\b" * @last_width) << "\r") if @last_width && @last_width > 0
@last_width = 0
$stdout.print("#{line}\r")
else
$stdout.puts(line)