ruby-changes:34626
From: nobu <ko1@a...>
Date: Sun, 6 Jul 2014 10:00:38 +0900 (JST)
Subject: [ruby-changes:34626] nobu:r46709 (trunk): rdoc/stats/normal.rb: clear previous output
nobu 2014-07-06 10:00:29 +0900 (Sun, 06 Jul 2014) New Revision: 46709 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=46709 Log: 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. Modified files: trunk/lib/rdoc/stats/normal.rb Index: lib/rdoc/stats/normal.rb =================================================================== --- lib/rdoc/stats/normal.rb (revision 46708) +++ lib/rdoc/stats/normal.rb (revision 46709) @@ -6,6 +6,7 @@ class RDoc::Stats::Normal < RDoc::Stats: https://github.com/ruby/ruby/blob/trunk/lib/rdoc/stats/normal.rb#L6 def begin_adding # :nodoc: puts "Parsing sources..." + @last_width = 0 end ## @@ -30,10 +31,10 @@ class RDoc::Stats::Normal < RDoc::Stats: https://github.com/ruby/ruby/blob/trunk/lib/rdoc/stats/normal.rb#L31 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) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/