mirror of
https://github.com/pry/pry.git
synced 2022-11-09 12:35:05 -05:00
fixed bug in Pry#readline() where Readline prompt would not be displayed when switching to another input object
This commit is contained in:
parent
3d9f8d1e5f
commit
b053ee1571
1 changed files with 21 additions and 21 deletions
|
@ -389,34 +389,34 @@ class Pry
|
|||
# @param [String] current_prompt The prompt to use for input.
|
||||
# @return [String] The next line of input.
|
||||
def readline(current_prompt="> ")
|
||||
should_retry = true
|
||||
|
||||
begin
|
||||
|
||||
if input == Readline
|
||||
line = input.readline(current_prompt, false)
|
||||
Pry.history << line.dup if line
|
||||
line
|
||||
else
|
||||
|
||||
if input == Readline
|
||||
line = input.readline(current_prompt, false)
|
||||
Pry.history << line.dup if line
|
||||
line
|
||||
else
|
||||
should_retry = true
|
||||
begin
|
||||
if input.method(:readline).arity == 1
|
||||
input.readline(current_prompt)
|
||||
else
|
||||
input.readline
|
||||
end
|
||||
|
||||
rescue EOFError
|
||||
if input_stack.empty?
|
||||
self.input = Pry.config.input
|
||||
if !should_retry
|
||||
output.puts "Error: Pry ran out of things to read from! Attempting to break out of REPL."
|
||||
throw(:breakout)
|
||||
end
|
||||
|
||||
should_retry = false
|
||||
else
|
||||
self.input = input_stack.pop
|
||||
end
|
||||
retry
|
||||
end
|
||||
rescue EOFError
|
||||
if input_stack.empty?
|
||||
self.input = Pry.config.input
|
||||
if !should_retry
|
||||
output.puts "Error: Pry ran out of things to read from! Attempting to break out of REPL."
|
||||
throw(:breakout)
|
||||
end
|
||||
should_retry = false
|
||||
else
|
||||
self.input = input_stack.pop
|
||||
end
|
||||
retry
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue