Rename reset_line to reset_eval_string

This commit is contained in:
Ryan Fitzgerald 2012-12-27 19:56:43 -08:00
parent a0cb2d2605
commit 48481a1bfd
2 changed files with 6 additions and 22 deletions

View File

@ -220,25 +220,9 @@ class Pry
}.merge(extra_sticky_locals)
end
# Initialize the repl session.
def repl_prologue
exec_hook :before_session, output, current_binding, self
# Clear the line before starting Pry. This fixes the issue discussed here:
# https://github.com/pry/pry/issues/566
if Pry.config.auto_indent
Kernel.print Pry::Helpers::BaseHelpers.windows_ansi? ? "\e[0F" : "\e[0G"
end
end
# Clean-up after the repl session.
def repl_epilogue
exec_hook :after_session, output, current_binding, self
Pry.save_history if Pry.config.history.should_save
end
def reset_line
# Reset the current eval string. If the user has entered part of a multiline
# expression, this discards that input.
def reset_eval_string
@eval_string = ""
end
@ -308,7 +292,7 @@ class Pry
complete_expr = Pry::Code.complete_expression?(@eval_string)
rescue SyntaxError => e
output.puts "SyntaxError: #{e.message.sub(/.*syntax error, */m, '')}"
reset_line
reset_eval_string
end
if complete_expr
@ -320,7 +304,7 @@ class Pry
# Reset eval string, in case we're evaluating Ruby that does something
# like open a nested REPL on this instance.
eval_string = @eval_string
reset_line
reset_eval_string
result = evaluate_ruby(eval_string)
rescue RescuableException => e

View File

@ -44,7 +44,7 @@ class Pry
case val = retrieve_line
when :control_c
output.puts ""
pry.reset_line
pry.reset_eval_string
when :no_more_input
output.puts "" if output.tty?
break