+ revert_color = false
+ str[0,5].match(/\033\[3(.)m/) { |c| #Line starts with an escape sequence. We handle that `a la xterm`
+ Ncurses.init_pair(10, c[1].to_i, Ncurses::COLOR_BLACK)
+ win.attron(Ncurses.COLOR_PAIR(10))
+ revert_color = true
+ str = str[5,str.length]
+ }
+ str = str.gsub("\011"," ")
+ #Any other control char is ignored and escaped
+ str = str.gsub(/[[:cntrl:]]/) { |m|
+ "^"+(m.ord + 64).chr
+ }