Project

General

Profile

Bug #19037

Updated by zw963 (Wei Zheng) over 1 year ago

When work with ruby 3.1.X, [looksee](https://github.com/oggy/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](https://github.com/oggy/looksee/issues/57#issuecomment-989731946) 

 But, it works before introduce Please check the colorful feature of IRB. discuss here 

 we can fix it use following workaround. https://github.com/oggy/looksee/issues/57 

 ```rb 
 IRB.conf[:USE_COLORIZE] = false 
 ``` 

 But, that will make IRB lose colorful. 

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

 following a screenshot, check [here](https://github.com/oggy/looksee/issues/57#issuecomment-999771143) 

 I thought this issue be fixed should possible, 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, code is colorful, and looksee output is colorful too. 


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

 so just ask here. 

 thank you.

Back