lib/unibits.rb in unibits-2.8.0 vs lib/unibits.rb in unibits-2.9.0
- old
+ new
@@ -244,12 +244,12 @@
enc_buffer.zip(hex_buffer, bin_buffer, separator).flatten.join("\n")
end
end
def self.determine_terminal_cols
- STDIN.winsize[1] || DEFAULT_TERMINAL_WIDTH
- rescue Errno::ENOTTY
- return DEFAULT_TERMINAL_WIDTH
+ STDIN.winsize[1] || ENV['COLUMNS'] || DEFAULT_TERMINAL_WIDTH
+ rescue Errno::ENOTTY, Errno::EBADF
+ return ENV['COLUMNS'] || DEFAULT_TERMINAL_WIDTH
end
def self.determine_char_color(char_info)
if !char_info.valid?
COLORS[:invalid]