lib/gli/terminal.rb in gli-2.13.1 vs lib/gli/terminal.rb in gli-2.13.2
- old
+ new
@@ -76,10 +76,14 @@
# Get the size of the current terminal.
# Ripped from hirb[https://github.com/cldwalker/hirb/blob/master/lib/hirb/util.rb]
#
# Returns an Array of size two Ints representing the terminal width and height
def size
- SIZE_DETERMINERS.select { |(predicate,ignore)| predicate.call }.first[1].call
+ SIZE_DETERMINERS.each do |predicate, get_size|
+ next unless predicate.call
+ size = get_size.call
+ return size unless size == [0, 0]
+ end
rescue Exception => ex
raise ex if @unsafe
Terminal.default_size
end