1
0
Fork 0
mirror of https://github.com/pry/pry.git synced 2022-11-09 12:35:05 -05:00

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 7af3660042.
This commit is contained in:
John Mair 2012-05-08 18:39:50 +12:00
parent ac54ebd795
commit 4fe5346d53
2 changed files with 8 additions and 14 deletions

View file

@ -333,25 +333,19 @@ class Pry
def retrieve_line(eval_string, target) def retrieve_line(eval_string, target)
@indent.reset if eval_string.empty? @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) 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 : '' indentation = Pry.config.auto_indent ? @indent.current_prefix : ''
completion_proc = Pry::InputCompleter.build_completion_proc(
target, instance_eval(&custom_completions))
begin begin
full_prompt = "#{column_reset}#{current_prompt}#{indentation}" val = readline("#{current_prompt}#{indentation}", completion_proc)
val = readline(full_prompt, completion_proc)
# Handle <Ctrl-C> like Bash: empty the current input buffer but do not # Handle <Ctrl+C> like Bash, empty the current input buffer but do not quit.
# quit. This is only for Ruby 1.9; other versions of Ruby do not let you # This is only for ruby-1.9; other versions of ruby do not let you send Interrupt
# send Interrupt from within Readline. # from within Readline.
rescue Interrupt => e rescue Interrupt => e
output.puts "" output.puts ""
eval_string.replace("") eval_string.replace("")

View file

@ -37,7 +37,7 @@ describe "test Pry defaults" do
end.new end.new
Pry.start(self, :input => arity_one_input, :output => Pry::NullOutput) 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 end
it 'should not pass in the prompt if the arity is 0' do it 'should not pass in the prompt if the arity is 0' do