diff options
Diffstat (limited to 'lib/pry')
| -rw-r--r-- | lib/pry/pry_instance.rb | 3 | ||||
| -rw-r--r-- | lib/pry/test/helper.rb | 5 |
2 files changed, 6 insertions, 2 deletions
diff --git a/lib/pry/pry_instance.rb b/lib/pry/pry_instance.rb index 0877ab24..bf843790 100644 --- a/lib/pry/pry_instance.rb +++ b/lib/pry/pry_instance.rb @@ -269,7 +269,7 @@ class Pry @suppress_output = false inject_sticky_locals! begin - if !process_command_safely(line.lstrip) + if !process_command_safely(line) @eval_string << "#{line.chomp}\n" if !line.empty? || !@eval_string.empty? end rescue RescuableException => e @@ -400,6 +400,7 @@ class Pry # @param [String] val The line to process. # @return [Boolean] `true` if `val` is a command, `false` otherwise def process_command(val) + val = val.lstrip if /^\s\S/ !~ val val = val.chomp result = commands.process_line(val, :target => current_binding, diff --git a/lib/pry/test/helper.rb b/lib/pry/test/helper.rb index aaa567af..2ef8289b 100644 --- a/lib/pry/test/helper.rb +++ b/lib/pry/test/helper.rb @@ -121,7 +121,10 @@ class PryTester result = nil strs.flatten.each do |str| - str = "#{str.strip}\n" + # Check for space prefix. See #1369. + if str !~ /^\s\S/ + str = "#{str.strip}\n" + end @history.push str if @history if @pry.process_command(str) |
