Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Pry.auto_resize! to respond to width changes. #737

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 12 additions & 0 deletions lib/pry/pry_class.rb
Expand Up @@ -240,6 +240,18 @@ def self.default_editor_for_platform
end
end

def self.auto_resize!
trap :WINCH do
begin
size = `stty size`.split(/\s+/).map &:to_i
Readline.set_screen_size *size
Readline.refresh_line
rescue Exception => e
warn "Pry.auto_resize! had exception: #{e}"
end
end
end

def self.set_config_defaults
config.input = Readline
config.output = $stdout
Expand Down