Escape colour codes

Thorsten Kampe thorsten@thorstenkampe.de
Thu Apr 5 07:31:00 GMT 2007


* Eric Blake (Wed, 4 Apr 2007 19:50:24 +0000 (UTC))
> Thorsten Kampe <thorsten <at> thorstenkampe.de> writes:
> > 9. Install Python and IPython (http://ipython.scipy.org/moin/)
> > set
> > prompt_in1 '\C_White[\#\C_White]\C_LightCyan>>> '
> > prompt_out '\C_White[\N\C_White]    '
> > in your ipythonrc and start IPython. Type 1 [Enter]
> 
> The bug is in IPython.
> 
> > 12. Remove the \001/\002 constructs in line 88 and 89 from 
> > ColorANSI.py in Cygwin IPython 
> > 
> > from
> >         Normal = '\001\033[0m\002'   # Reset normal coloring
> >         _base  = '\001\033[%sm\002'  # Template for all other colors
> > 
> > to
> > 
> >         Normal = '\033[0m'   # Reset normal coloring
> >         _base  = '\033[%sm'  # Template for all other colors
> 
> I'm not sure if this is correct.  If you pass invisible characters to readline 
> without marking them as such, using \1 and \2, then readline messes up the 
> display width.

The "from" is the original code, the "to" is my modification to show 
that omitting the \001/\002 constructs will make IPython not show the 
colour escape codes. Of course this wasn't meant as a solution because 
the escapes are there for a reason (as you correctly pointed out). 
Simply removing them will just introduce a new kind of problem.

Thorsten


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list