Skip to content

Commit

Permalink
Fix for irb crash during completion
Browse files Browse the repository at this point in the history
For some Ruby implementations Readline.point is missing. This causes irb
to crash under Ruby Enterprise Edition 2011.12 for any irb completion
that is attempted. This change at least avoids the crash though the
original function (opening the text editor) cannot be executed anymore.
  • Loading branch information
flori authored and tpope committed Mar 1, 2012
1 parent db62496 commit 2238495
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/pry-editline.rb
Expand Up @@ -48,7 +48,9 @@ def self.hijack_inputrc

def self.completion_proc
lambda do |s|
if Readline.point == 0 && Readline.line_buffer =~ / $/
if Readline.respond_to?(:point) && Readline.respond_to?(:line_buffer) &&
Readline.point == 0 && Readline.line_buffer =~ / $/
then
require 'tempfile'
Tempfile.open(['readline-','.rb']) do |f|
f.puts(Readline.line_buffer[0..-3])
Expand Down

0 comments on commit 2238495

Please sign in to comment.