Skip to content

Commit

Permalink
InputMethod#winsize fallback to [24, 80] if width or height is zero
Browse files Browse the repository at this point in the history
  • Loading branch information
tompng committed Jan 23, 2025
1 parent 4d77944 commit d436dcb
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/irb/input-method.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@ def gets

def winsize
if instance_variable_defined?(:@stdout) && @stdout.tty?
@stdout.winsize
else
[24, 80]
winsize = @stdout.winsize
# If width or height is 0, something is wrong.
return winsize unless winsize.include? 0
end
[24, 80]
end

# Whether this input method is still readable when there is no more data to
Expand Down

0 comments on commit d436dcb

Please sign in to comment.