From 4fe5346d53570c06a15a020d5c8461d07061e92c Mon Sep 17 00:00:00 2001 From: John Mair Date: Tue, 8 May 2012 18:39:50 +1200 Subject: [PATCH] Revert "Always start the prompt in the first column (fix #551)" This fixes #564 this commit does more harm than good, as it causes things to break badly on libedit. The bug it's fixing is also quite trivial and highly unlikely to annoy anybody in practice. This reverts commit 7af3660042797ef37008cee7585858ffbc483543. --- lib/pry/pry_instance.rb | 20 +++++++------------- test/test_pry_defaults.rb | 2 +- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/lib/pry/pry_instance.rb b/lib/pry/pry_instance.rb index b2838688..0e602789 100644 --- a/lib/pry/pry_instance.rb +++ b/lib/pry/pry_instance.rb @@ -333,25 +333,19 @@ class Pry def retrieve_line(eval_string, target) @indent.reset if eval_string.empty? - # If necessary, make sure the prompt starts in the first column (issue #551) - if Pry::Helpers::BaseHelpers.use_ansi_codes? && Pry.config.correct_indent - column_reset = "\e[0G" - end - current_prompt = select_prompt(eval_string, target) + completion_proc = Pry::InputCompleter.build_completion_proc(target, + instance_eval(&custom_completions)) + indentation = Pry.config.auto_indent ? @indent.current_prefix : '' - completion_proc = Pry::InputCompleter.build_completion_proc( - target, instance_eval(&custom_completions)) - begin - full_prompt = "#{column_reset}#{current_prompt}#{indentation}" - val = readline(full_prompt, completion_proc) + val = readline("#{current_prompt}#{indentation}", completion_proc) - # Handle like Bash: empty the current input buffer but do not - # quit. This is only for Ruby 1.9; other versions of Ruby do not let you - # send Interrupt from within Readline. + # Handle like Bash, empty the current input buffer but do not quit. + # This is only for ruby-1.9; other versions of ruby do not let you send Interrupt + # from within Readline. rescue Interrupt => e output.puts "" eval_string.replace("") diff --git a/test/test_pry_defaults.rb b/test/test_pry_defaults.rb index 8ece9844..43e5c534 100644 --- a/test/test_pry_defaults.rb +++ b/test/test_pry_defaults.rb @@ -37,7 +37,7 @@ describe "test Pry defaults" do end.new Pry.start(self, :input => arity_one_input, :output => Pry::NullOutput) - arity_one_input.prompt.should.include? Pry.prompt.call + arity_one_input.prompt.should == Pry.prompt.call end it 'should not pass in the prompt if the arity is 0' do