mirror of
https://github.com/pry/pry.git
synced 2022-11-09 12:35:05 -05:00
Use correct_indent not auto_indent...
Prior to this change, when auto_indent was set to true for some tests, the green dots would be cleared half-way through. We should probably re-consider these options, but it seems useful to explicitly disable ANSI code rewriting during specs while leaving indentation mutating read lines (before this change, there was a bug in REPL that did not manifest because auto_indent was false).
This commit is contained in:
parent
fdb703a8de
commit
8a23c9a8a7
3 changed files with 6 additions and 14 deletions
|
@ -33,7 +33,7 @@ class Pry
|
||||||
pry.exec_hook :before_session, pry.output, pry.current_binding, pry
|
pry.exec_hook :before_session, pry.output, pry.current_binding, pry
|
||||||
# Clear the line before starting Pry. This fixes the issue discussed here:
|
# Clear the line before starting Pry. This fixes the issue discussed here:
|
||||||
# https://github.com/pry/pry/issues/566
|
# https://github.com/pry/pry/issues/566
|
||||||
if Pry.config.auto_indent
|
if Pry.config.correct_indent
|
||||||
Kernel.print Pry::Helpers::BaseHelpers.windows_ansi? ? "\e[0F" : "\e[0G"
|
Kernel.print Pry::Helpers::BaseHelpers.windows_ansi? ? "\e[0F" : "\e[0G"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -80,13 +80,13 @@ class Pry
|
||||||
# This is only for ruby-1.9; other versions of ruby do not let you send Interrupt
|
# This is only for ruby-1.9; other versions of ruby do not let you send Interrupt
|
||||||
# from within Readline.
|
# from within Readline.
|
||||||
rescue Interrupt
|
rescue Interrupt
|
||||||
return :control_c
|
val = :control_c
|
||||||
end
|
end
|
||||||
|
|
||||||
# return nil for EOF
|
# return nil for EOF, :no_more_input for error, or :control_c for <ctrl+c>
|
||||||
return unless val
|
return val unless String === val
|
||||||
|
|
||||||
if Pry.config.auto_indent && !input.is_a?(StringIO)
|
if Pry.config.auto_indent
|
||||||
original_val = "#{indentation}#{val}"
|
original_val = "#{indentation}#{val}"
|
||||||
indented_val = @indent.indent(val)
|
indented_val = @indent.indent(val)
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ class << Pry
|
||||||
Pry.config.should_load_plugins = false
|
Pry.config.should_load_plugins = false
|
||||||
Pry.config.history.should_load = false
|
Pry.config.history.should_load = false
|
||||||
Pry.config.history.should_save = false
|
Pry.config.history.should_save = false
|
||||||
Pry.config.auto_indent = false
|
Pry.config.correct_indent = false
|
||||||
Pry.config.hooks = Pry::Hooks.new
|
Pry.config.hooks = Pry::Hooks.new
|
||||||
Pry.config.collision_warning = false
|
Pry.config.collision_warning = false
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,14 +1,6 @@
|
||||||
require 'helper'
|
require 'helper'
|
||||||
|
|
||||||
describe "The whole thing" do
|
describe "The whole thing" do
|
||||||
before do
|
|
||||||
Pry.config.auto_indent = true
|
|
||||||
end
|
|
||||||
|
|
||||||
after do
|
|
||||||
Pry.config.auto_indent = false
|
|
||||||
end
|
|
||||||
|
|
||||||
it "should let you run commands in the middle of multiline expressions" do
|
it "should let you run commands in the middle of multiline expressions" do
|
||||||
ReplTester.start do
|
ReplTester.start do
|
||||||
input 'def a'
|
input 'def a'
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue