diff options
author | Takashi Kokubun <takashikkbn@gmail.com> | 2019-05-25 07:48:58 -0700 |
---|---|---|
committer | Takashi Kokubun <takashikkbn@gmail.com> | 2019-05-25 07:49:15 -0700 |
commit | ada64aa9e7f1e087b9fd536d9bc512de401f42a0 (patch) | |
tree | 083d5c1b46c0a009519dc70c248f0cef267cdd8b /lib/irb | |
parent | 7c507345a73afe3f599e407e851b9c0d708adeb0 (diff) |
Clear IRB::Color escape sequence before newline
because otherwise prompt and other things could be polluted.
Diffstat (limited to 'lib/irb')
-rw-r--r-- | lib/irb/color.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/irb/color.rb b/lib/irb/color.rb index 8cee483261..ad5b203010 100644 --- a/lib/irb/color.rb +++ b/lib/irb/color.rb @@ -82,7 +82,7 @@ module IRB # :nodoc: Ripper.lex(code).each do |(_line, _col), token, str, expr| if seq = dispatch_seq(token, expr, str) Reline::Unicode.escape_for_print(str).each_line do |line| - colored << "#{seq.map { |s| "\e[#{s}m" }.join('')}#{line}#{clear}" + colored << "#{seq.map { |s| "\e[#{s}m" }.join('')}#{line.sub(/\n?\z/, "#{clear}\\0")}" end else colored << Reline::Unicode.escape_for_print(str) |