Skip to content

Commit 5725677

Browse files
committed
Degenerate the terminal size to [$LINES, $COLUMNS] if it is unknown
This is a workaround for ruby/irb#50
1 parent d98ac8f commit 5725677

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/reline/ansi.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,11 @@ def self.retrieve_keybuffer
5050
end
5151

5252
def self.get_screen_size
53-
@@input.winsize
53+
s = @@input.winsize
54+
return s if s[0] > 0 && s[1] > 0
55+
s = [ENV["LINES"].to_i, ENV["COLUMNS"].to_i]
56+
return s if s[0] > 0 && s[1] > 0
57+
[24, 80]
5458
rescue Errno::ENOTTY
5559
[24, 80]
5660
end

0 commit comments

Comments
 (0)