Permalink
Browse files

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 7af3660.
  • Loading branch information...
1 parent ac54ebd commit 4fe5346d53570c06a15a020d5c8461d07061e92c @banister banister committed May 8, 2012
Showing with 8 additions and 14 deletions.
  1. +7 −13 lib/pry/pry_instance.rb
  2. +1 −1 test/test_pry_defaults.rb
@@ -333,25 +333,19 @@ def should_force_encoding?(eval_string, val)
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))
+ indentation = Pry.config.auto_indent ? @indent.current_prefix : ''
begin
- full_prompt = "#{column_reset}#{current_prompt}#{indentation}"
- val = readline(full_prompt, completion_proc)
+ val = readline("#{current_prompt}#{indentation}", completion_proc)
- # Handle <Ctrl-C> 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 <Ctrl+C> 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("")
@@ -37,7 +37,7 @@ def readline(prompt)
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

1 comment on commit 4fe5346

@rf-
Member
rf- commented on 4fe5346 May 8, 2012

I think just printing the reset char instead of putting it into the prompt itself would probably fix both issues. I agree that it may not be worth it though.

Please sign in to comment.