Fix pry bug that display color escape code#417
Fix pry bug that display color escape code#417tzmfreedom wants to merge 1 commit intoBetterErrors:masterfrom
Conversation
f0f6f2d to
4dd99c2
Compare
|
@tzmfreedom can you give an example to reproduce this issue? I would prefer to add a test that covers this fix. |
|
@RobinDaugherty sorry for my late reply. This is example code to reproduce this issue. (run by require 'better_errors/repl/pry'
e = begin
raise
rescue => e
e
end
repl = BetterErrors::REPL::Pry.new(binding, e)
pp repl.send_input('1*2')
# =>
# ["\n" +
# "\e[1mFrom:\e[0m /Users/hoge/rails5/hoge.rb @ line 10 :\n" +
# "\n" +
# " \e[1;34m5\e[0m: raise\n" +
# " \e[1;34m6\e[0m: \e[32mrescue\e[0m => e\n" +
# " \e[1;34m7\e[0m: e\n" +
# " \e[1;34m8\e[0m: \e[32mend\e[0m\n" +
# " \e[1;34m9\e[0m: \n" +
# " => \e[1;34m10\e[0m: ins = \e[1;34;4mBetterErrors\e[0m::\e[1;34;4mREPL\e[0m::\e[1;34;4mPry\e[0m.new(binding, e)\n" +
# " \e[1;34m11\e[0m: pp ins.send_input(\e[31m\e[1;31m'\e[0m\e[31m1*2\e[1;31m'\e[0m\e[31m\e[0m)\n" +
# " \e[1;34m12\e[0m: pp ins.send_input(\e[31m\e[1;31m'\e[0m\e[31m3\e[1;31m'\e[0m\e[31m\e[0m)\n" +
# "\n" +
# "=> \e[1;34m2\e[0m\n",
# ">>",
# ""]If this PR is applied, output doesn't contain source code with color escape code. |
e62b149 to
b6b45cc
Compare
b6b45cc to
183e191
Compare
|
@RobinDaugherty |
|
Thanks @tzmfreedom, sorry this hasn't been moving. My plan is to separate Pry support into a separate gem (#400) but I haven't had time to finish that transition yet. My plan in that project is to support color output rather than disable it by default, but perhaps your change is best for the core project while we wait to transition. |
This pullrequest solve the problem that REPL response display source code on first request, and contain color escape code if we use pry (>= 0.11.0) for REPL.
REPL response sample before (contain source code with color escape code)
after(this pullrequest), it contains only REPL response, so does not contain source code with color escape code.