зеркало из https://github.com/github/ruby.git
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:
Родитель
25e8f524f2
Коммит
d054cab611
|
@ -1,3 +1,5 @@
|
||||||
|
require 'io/console/size'
|
||||||
|
|
||||||
##
|
##
|
||||||
# Stats printer that prints just the files being documented with a progress
|
# Stats printer that prints just the files being documented with a progress
|
||||||
# bar
|
# 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
|
# Print a progress bar, but make sure it fits on a single line. Filename
|
||||||
# will be truncated if necessary.
|
# 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
|
max_filename_size = terminal_width - progress_bar.size
|
||||||
|
|
||||||
if filename.size > max_filename_size then
|
if filename.size > max_filename_size then
|
||||||
|
|
Загрузка…
Ссылка в новой задаче