[前][次][番号順一覧][スレッド一覧]

ruby-changes:34627

From: nobu <ko1@a...>
Date: Sun, 6 Jul 2014 10:00:42 +0900 (JST)
Subject: [ruby-changes:34627] nobu:r46710 (trunk): rdoc/stats/normal.rb: IO.console_size

nobu	2014-07-06 10:00:34 +0900 (Sun, 06 Jul 2014)

  New Revision: 46710

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=46710

  Log:
    rdoc/stats/normal.rb: IO.console_size
    
    * lib/rdoc/stats/normal.rb (print_file): use IO.console_size to
      follow window resize.

  Modified files:
    trunk/lib/rdoc/stats/normal.rb
Index: lib/rdoc/stats/normal.rb
===================================================================
--- lib/rdoc/stats/normal.rb	(revision 46709)
+++ lib/rdoc/stats/normal.rb	(revision 46710)
@@ -1,3 +1,5 @@ https://github.com/ruby/ruby/blob/trunk/lib/rdoc/stats/normal.rb#L1
+require 'io/console/size'
+
 ##
 # Stats printer that prints just the files being documented with a progress
 # bar
@@ -20,7 +22,7 @@ class RDoc::Stats::Normal < RDoc::Stats: https://github.com/ruby/ruby/blob/trunk/lib/rdoc/stats/normal.rb#L22
 
     # Print a progress bar, but make sure it fits on a single line. Filename
     # will be truncated if necessary.
-    terminal_width = (ENV['COLUMNS'] || 80).to_i
+    terminal_width = IO.console_size[1].to_i.nonzero? || 80
     max_filename_size = terminal_width - progress_bar.size
 
     if filename.size > max_filename_size then

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]