diff options
author | tomoya ishida <tomoyapenguin@gmail.com> | 2023-02-13 05:27:27 +0900 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2023-02-12 20:27:32 +0000 |
commit | f313514563853f1ee623135c2959df2b518ee755 (patch) | |
tree | 797b73d013f0781fafda841a3d8da14d70ca94c8 | |
parent | 6517d1a188cb0b9aff70f93df8630105dbb98ebc (diff) | |
download | ruby-f313514563853f1ee623135c2959df2b518ee755.tar.gz |
[ruby/irb] Fix colorize backtick symbol
(https://github.com/ruby/irb/pull/508)
https://github.com/ruby/irb/commit/dd7f25cd45
Co-authored-by: Stan Lo <stan001212@gmail.com>
-rw-r--r-- | lib/irb/color.rb | 2 | ||||
-rw-r--r-- | test/irb/test_color.rb | 1 |
2 files changed, 2 insertions, 1 deletions
diff --git a/lib/irb/color.rb b/lib/irb/color.rb index 6378e14856..52d6240910 100644 --- a/lib/irb/color.rb +++ b/lib/irb/color.rb @@ -242,7 +242,7 @@ module IRB # :nodoc: case token when :on_symbeg, :on_symbols_beg, :on_qsymbols_beg @stack << true - when :on_ident, :on_op, :on_const, :on_ivar, :on_cvar, :on_gvar, :on_kw + when :on_ident, :on_op, :on_const, :on_ivar, :on_cvar, :on_gvar, :on_kw, :on_backtick if @stack.last # Pop only when it's Symbol @stack.pop return prev_state diff --git a/test/irb/test_color.rb b/test/irb/test_color.rb index ca4ae4b8f9..fbcb283a6d 100644 --- a/test/irb/test_color.rb +++ b/test/irb/test_color.rb @@ -90,6 +90,7 @@ module TestIRB ":class" => "#{YELLOW}:#{CLEAR}#{YELLOW}class#{CLEAR}", "[:end, 2]" => "[#{YELLOW}:#{CLEAR}#{YELLOW}end#{CLEAR}, #{BLUE}#{BOLD}2#{CLEAR}]", "[:>, 3]" => "[#{YELLOW}:#{CLEAR}#{YELLOW}>#{CLEAR}, #{BLUE}#{BOLD}3#{CLEAR}]", + "[:`, 4]" => "[#{YELLOW}:#{CLEAR}#{YELLOW}`#{CLEAR}, #{BLUE}#{BOLD}4#{CLEAR}]", ":Hello ? world : nil" => "#{YELLOW}:#{CLEAR}#{YELLOW}Hello#{CLEAR} ? world : #{CYAN}#{BOLD}nil#{CLEAR}", 'raise "foo#{bar}baz"' => "raise #{RED}#{BOLD}\"#{CLEAR}#{RED}foo#{CLEAR}#{RED}\#{#{CLEAR}bar#{RED}}#{CLEAR}#{RED}baz#{CLEAR}#{RED}#{BOLD}\"#{CLEAR}", '["#{obj.inspect}"]' => "[#{RED}#{BOLD}\"#{CLEAR}#{RED}\#{#{CLEAR}obj.inspect#{RED}}#{CLEAR}#{RED}#{BOLD}\"#{CLEAR}]", |