From c3ce60e7499fc5b3e2235f38bb98cf3b0b30effe Mon Sep 17 00:00:00 2001 From: John Mair Date: Sun, 9 Oct 2011 06:49:01 +1300 Subject: [PATCH] indentation is now reset if the eval_string is cleared (i.e when the ! command is invoked) --- lib/pry/pry_instance.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/pry/pry_instance.rb b/lib/pry/pry_instance.rb index 04524052..58e5ea4b 100644 --- a/lib/pry/pry_instance.rb +++ b/lib/pry/pry_instance.rb @@ -287,7 +287,10 @@ class Pry # @param [Binding] target The target of the session. # @return [String] The line received. def retrieve_line(eval_string, target) + @indent.reset if eval_string.empty? + current_prompt = select_prompt(eval_string.empty?, target.eval('self')) + val = readline(current_prompt) # exit session if we receive EOF character (^D) @@ -436,9 +439,7 @@ class Pry # @param [String] current_prompt The prompt to use for input. # @return [String] The next line of input. def readline(current_prompt="> ") - if Pry.config.auto_indent - current_prompt += @indent.stack[-1] || '' - end + current_prompt += @indent.indent_level || '' if Pry.config.auto_indent handle_read_errors do if input == Readline