1
0
Fork 0
mirror of https://github.com/pry/pry.git synced 2022-11-09 12:35:05 -05:00

Don't assume Readline is loaded in auto_resize

This commit is contained in:
Ryan Fitzgerald 2014-02-02 17:36:06 -08:00
parent bfe70aa165
commit 95d0ca534b

View file

@ -233,15 +233,22 @@ class Pry
end
def self.auto_resize!
ver = Readline::VERSION
if ver[/edit/i]
Pry.config.input # by default, load Readline
if !defined?(Readline) || Pry.config.input != Readline
warn "Sorry, you must be using Readline for Pry.auto_resize! to work."
return
end
if Readline::VERSION =~ /edit/i
warn <<-EOT
Readline version #{ver} detected - will not auto_resize! correctly.
Readline version #{Readline::VERSION} detected - will not auto_resize! correctly.
For the fix, use GNU Readline instead:
https://github.com/guard/guard/wiki/Add-proper-Readline-support-to-Ruby-on-Mac-OS-X
EOT
return
end
trap :WINCH do
begin
Readline.set_screen_size(*Terminal.size!)