rdoc/stats/normal.rb: IO.console_size

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

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

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

@ -1,3 +1,5 @@
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::Quiet
# 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