From 25e8f524f2676514e999d5fcbb08fadbf82b0bb5 Mon Sep 17 00:00:00 2001 From: nobu Date: Sun, 6 Jul 2014 01:00:29 +0000 Subject: 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 --- lib/rdoc/stats/normal.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/rdoc/stats/normal.rb b/lib/rdoc/stats/normal.rb index 02714c526b..f1a88d4a6b 100644 --- a/lib/rdoc/stats/normal.rb +++ b/lib/rdoc/stats/normal.rb @@ -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) -- cgit v1.2.3