diff options
author | Yusuke Endoh <mame@ruby-lang.org> | 2019-12-29 09:01:00 +0900 |
---|---|---|
committer | aycabta <aycabta@gmail.com> | 2019-12-31 23:32:24 +0900 |
commit | 337ba56aff37d34896c0dd091f1bcfb4a556126b (patch) | |
tree | 157070a91f1c0199203b46d0f05a96c3d7e7739d /lib | |
parent | e082f41611755b0fde967fccf3174c90ecb8469e (diff) | |
download | ruby-337ba56aff37d34896c0dd091f1bcfb4a556126b.tar.gz |
[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
Diffstat (limited to 'lib')
-rw-r--r-- | lib/reline/ansi.rb | 6 |
1 files changed, 5 insertions, 1 deletions
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 |