diff options
author | Takashi Kokubun <takashikkbn@gmail.com> | 2019-05-26 11:32:23 -0700 |
---|---|---|
committer | Takashi Kokubun <takashikkbn@gmail.com> | 2019-05-26 11:32:23 -0700 |
commit | 64ee8900c89444692c6a51f0153869cb634bb086 (patch) | |
tree | 956cc93234f91e4a6068a350259a1a80d9e75bca | |
parent | 7597f7ecb18ae537002391f9feb7f0e689d3b87b (diff) | |
download | ruby-64ee8900c89444692c6a51f0153869cb634bb086.tar.gz |
Highlight global variable on IRB
-rw-r--r-- | lib/irb/color.rb | 3 | ||||
-rw-r--r-- | test/irb/test_color.rb | 1 |
2 files changed, 3 insertions, 1 deletions
diff --git a/lib/irb/color.rb b/lib/irb/color.rb index da8791bc9f..de91f29a12 100644 --- a/lib/irb/color.rb +++ b/lib/irb/color.rb @@ -30,12 +30,13 @@ module IRB # :nodoc: TOKEN_SEQ_EXPRS = { on_CHAR: [[BLUE, BOLD], ALL], on_backtick: [[RED], ALL], - on_const: [[BLUE, BOLD, UNDERLINE], ALL], on_comment: [[BLUE, BOLD], ALL], + on_const: [[BLUE, BOLD, UNDERLINE], ALL], on_embexpr_beg: [[RED], ALL], on_embexpr_end: [[RED], ALL], on_embvar: [[RED], ALL], on_float: [[MAGENTA, BOLD], ALL], + on_gvar: [[GREEN, BOLD], ALL], on_heredoc_beg: [[RED], ALL], on_heredoc_end: [[RED], ALL], on_ident: [[BLUE, BOLD], Ripper::EXPR_ENDFN], diff --git a/test/irb/test_color.rb b/test/irb/test_color.rb index 577c737662..4342a7ca6f 100644 --- a/test/irb/test_color.rb +++ b/test/irb/test_color.rb @@ -64,6 +64,7 @@ module TestIRB "`echo`" => "#{RED}`#{CLEAR}#{RED}echo#{CLEAR}#{RED}`#{CLEAR}", "\t" => "\t", # not ^I "foo(*%W(bar))" => "foo(*#{RED}%W(#{CLEAR}#{RED}bar#{CLEAR}#{RED})#{CLEAR})", + "$stdout" => "#{GREEN}#{BOLD}$stdout#{CLEAR}", }.each do |code, result| actual = with_term { IRB::Color.colorize_code(code) } assert_equal(result, actual, "Case: colorize_code(#{code.dump})\nResult: #{humanized_literal(actual)}") |