# File lib/pry/indent.rb, line 316 def screen_size [ # io/console adds a winsize method to IO streams. $stdout.tty? && $stdout.respond_to?(:winsize) && $stdout.winsize, # Some readlines also provides get_screen_size. Readline.respond_to?(:get_screen_size) && Readline.get_screen_size, # Otherwise try to use the environment (this may be out of date due # to window resizing, but it's better than nothing). [ENV["ROWS"], ENV["COLUMNS"], # If the user is running within ansicon, then use the screen size # that it reports (same caveats apply as with ROWS and COLUMNS) ENV['ANSICON'] =~ /\((.*)x(.*)\)/ && [$2, $1] ] ].detect do |(_, cols)| cols.to_i > 0 end end