Project

General

Profile

Actions

Bug #19037

closed

[Ruby 3.1.2] irb display color character not correct(as literal form) when set IRB.conf[:USE_COLORIZE] = true (it is default)

Added by zw963 (Wei Zheng) about 2 years ago. Updated almost 2 years ago.

Status:
Feedback
Assignee:
-
Target version:
-
[ruby-core:110185]

Description

When work with ruby 3.1.X, looksee gem could not display color character correct in new version IRB, as you can see as following:

^[[1;37m[Roda::RodaPlugins::Sprockets::Task instance]^[[0m
  ^[[1;32mbindings^[[0m                     ^[[1;32mirb_cwb^[[0m                      ^[[1;32mkill^[[0m       
  ^[[1;32mcb^[[0m                           ^[[1;32mirb_cws^[[0m                      ^[[1;32mls^[[0m         
  ^[[1;32mchws^[[0m                         ^[[1;32mirb_cwws^[[0m                     ^[[1;32mmeasure^[[0m    
  ^[[1;32mconf^[[0m                         ^[[1;32mirb_pop_binding^[[0m              ^[[1;32mpopb^[[0m       
  ^[[1;32mcontext^[[0m                      ^[[1;32mirb_popb^[[0m                     ^[[1;32mpopws^[[0m      
  ^[[1;32mcws^[[0m                          ^[[1;32mirb_popws^[[0m                    ^[[1;32mpushb^[[0m      
  ^[[1;32mcwws^[[0m                         ^[[1;32mirb_print_working_binding^[[0m    ^[[1;32mpushws^[[0m     
  ^[[1;32mexit^[[0m                         ^[[1;32mirb_print_working_workspace^[[0m  ^[[1;32mpwws^[[0m       
  ^[[1;32mfg^[[0m                           ^[[1;32mirb_push_binding^[[0m             ^[[1;32mquit^[[0m       
  ^[[1;32mhelp^[[0m                         ^[[1;32mirb_pushb^[[0m                    ^[[1;32mshow_source^[[0m
  ^[[1;32mirb_bindings^[[0m                 ^[[1;32mirb_pushws^[[0m                   ^[[1;32msource^[[0m     
  ^[[1;32mirb_cb^[[0m                       ^[[1;32mirb_pwb^[[0m                      ^[[1;32mwhereami^[[0m   
  ^[[1;32mirb_change_binding^[[0m           ^[[1;32mirb_pwws^[[0m                     ^[[1;32mworkspaces^[[0m 
  ^[[1;32mirb_chws^[[0m                     ^[[1;32mirb_quit^[[0m                   
  ^[[1;32mirb_current_working_binding^[[0m  ^[[1;32mjobs^[[0m    

reproduce process here

But, it works before introduce the colorful feature of IRB, and work still quite well with Pry.

we can fix this issue use following workaround.

IRB.conf[:USE_COLORIZE] = false

But, that will make IRB lose colorful.

So, i thought somethings break changes introduced since new IRB released.

following is a screenshot, check how looks here

I thought this issue should possible be fixed, so, i do some hack myself.

if change https://github.com/ruby/ruby/blob/v3_1_2/lib/irb/context.rb#L56 line from
@use_colorize = IRB.conf[:USE_COLORIZE] into @use_colorize = false, it works perfect,
that is, irb is colorful, and looksee output is colorful too.

But, above source code was moved on newest master, I am not sure if this issue was fixed in ruby 3.2.0 too.
because install ruby-head or 3.2.0-preview both failed on my laptop use RVM.

so just ask here.

thank you.

Updated by hsbt (Hiroshi SHIBATA) about 2 years ago

  • Status changed from Open to Feedback

Can you update the details of your request/question? It's hard to understand by "Please check the discuss here".

Updated by mame (Yusuke Endoh) about 2 years ago

Please write your ticket as self-contained and concise as possible.

Actions #3

Updated by zw963 (Wei Zheng) about 2 years ago

  • Subject changed from [Ruby 3.1.2] irb output color as literal when set IRB.conf[:USE_COLORIZE] = true (it is default) to [Ruby 3.1.2] irb display color character not correct(as literal form) when set IRB.conf[:USE_COLORIZE] = true (it is default)
  • Description updated (diff)

Updated by zw963 (Wei Zheng) about 2 years ago

mame (Yusuke Endoh) wrote in #note-2:

Please write your ticket as self-contained and concise as possible.

Done edit, please check.

Actions #5

Updated by zw963 (Wei Zheng) about 2 years ago

  • Description updated (diff)

Updated by zw963 (Wei Zheng) about 2 years ago

zw963 (Wei Zheng) wrote in #note-4:

mame (Yusuke Endoh) wrote in #note-2:

Please write your ticket as self-contained and concise as possible.

Done edit, please check.

Any update?

Updated by zw963 (Wei Zheng) almost 2 years ago

zw963 (Wei Zheng) wrote in #note-6:

zw963 (Wei Zheng) wrote in #note-4:

mame (Yusuke Endoh) wrote in #note-2:

Please write your ticket as self-contained and concise as possible.

Done edit, please check.

Any update?

Hi, this issue get workaround by looksee gem, so, it works now.

Thanks.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0