diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-07-06 01:00:29 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-07-06 01:00:29 +0000 |
commit | 25e8f524f2676514e999d5fcbb08fadbf82b0bb5 (patch) | |
tree | 5005576edf2d5a33e6e9f30fa8b7112e245c4ad3 /lib/rdoc | |
parent | 31cd6420a1e30fe14bbdcdce0bc7d6bcae0fc5d1 (diff) |
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
Diffstat (limited to 'lib/rdoc')
-rw-r--r-- | lib/rdoc/stats/normal.rb | 7 |
1 files changed, 4 insertions, 3 deletions
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) |