Skip to content

Commit dd7f25c

Browse files
tompngst0012
andauthored
Fix colorize backtick symbol (#508)
Co-authored-by: Stan Lo <stan001212@gmail.com>
1 parent 6fdf4f3 commit dd7f25c

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

lib/irb/color.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ def scan_token(token)
242242
case token
243243
when :on_symbeg, :on_symbols_beg, :on_qsymbols_beg
244244
@stack << true
245-
when :on_ident, :on_op, :on_const, :on_ivar, :on_cvar, :on_gvar, :on_kw
245+
when :on_ident, :on_op, :on_const, :on_ivar, :on_cvar, :on_gvar, :on_kw, :on_backtick
246246
if @stack.last # Pop only when it's Symbol
247247
@stack.pop
248248
return prev_state

test/irb/test_color.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ def test_colorize_code
9090
":class" => "#{YELLOW}:#{CLEAR}#{YELLOW}class#{CLEAR}",
9191
"[:end, 2]" => "[#{YELLOW}:#{CLEAR}#{YELLOW}end#{CLEAR}, #{BLUE}#{BOLD}2#{CLEAR}]",
9292
"[:>, 3]" => "[#{YELLOW}:#{CLEAR}#{YELLOW}>#{CLEAR}, #{BLUE}#{BOLD}3#{CLEAR}]",
93+
"[:`, 4]" => "[#{YELLOW}:#{CLEAR}#{YELLOW}`#{CLEAR}, #{BLUE}#{BOLD}4#{CLEAR}]",
9394
":Hello ? world : nil" => "#{YELLOW}:#{CLEAR}#{YELLOW}Hello#{CLEAR} ? world : #{CYAN}#{BOLD}nil#{CLEAR}",
9495
'raise "foo#{bar}baz"' => "raise #{RED}#{BOLD}\"#{CLEAR}#{RED}foo#{CLEAR}#{RED}\#{#{CLEAR}bar#{RED}}#{CLEAR}#{RED}baz#{CLEAR}#{RED}#{BOLD}\"#{CLEAR}",
9596
'["#{obj.inspect}"]' => "[#{RED}#{BOLD}\"#{CLEAR}#{RED}\#{#{CLEAR}obj.inspect#{RED}}#{CLEAR}#{RED}#{BOLD}\"#{CLEAR}]",

0 commit comments

Comments
 (0)