From 337ba56aff37d34896c0dd091f1bcfb4a556126b Mon Sep 17 00:00:00 2001 From: Yusuke Endoh Date: Sun, 29 Dec 2019 09:01:00 +0900 Subject: [ruby/reline] Degenerate the terminal size to [$LINES, $COLUMNS] if it is unknown This is a workaround for https://github.com/ruby/irb/issues/50 https://github.com/ruby/reline/commit/5725677d1a --- lib/reline/ansi.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lib/reline/ansi.rb') diff --git a/lib/reline/ansi.rb b/lib/reline/ansi.rb index 8d83da854c..27157f0db9 100644 --- a/lib/reline/ansi.rb +++ b/lib/reline/ansi.rb @@ -50,7 +50,11 @@ class Reline::ANSI end def self.get_screen_size - @@input.winsize + s = @@input.winsize + return s if s[0] > 0 && s[1] > 0 + s = [ENV["LINES"].to_i, ENV["COLUMNS"].to_i] + return s if s[0] > 0 && s[1] > 0 + [24, 80] rescue Errno::ENOTTY [24, 80] end -- cgit v1.2.3