[IPython-user] feature request

Robert Kern robert.kern@gmail....
Mon Jan 18 15:03:22 CST 2010

On 2010-01-18 14:47 PM, Flavio Coelho wrote:
> I was not refering to the curses popup completion and call tips, but
> just using Pygments  to highlight code as it is entered. Does Pygment
> depend on Curses? I don't think so. Example:
> from  pygments  import  highlight
> from  pygments.lexers  import  PythonLexer
> from  pygments.formatters  import  TerminalFormatter
> code  =  'print"Hello World"'
> print  highlight(code,  PythonLexer(),  TerminalFormatter())
> Voilá, you get highlighted code in the terminal, without the need for curses....

The highlighting part itself is fine. However, highlighting text *on the fly*, 
as bpython does, requires more sophisticated terminal manipulation since you 
have to go back and replace the current block. It's not *impossible* to do 
without curses, but curses makes it tractable on the platforms it supports.

But that said, if you can write it without requiring curses and without imposing 
too much tricky terminal-specific code that we would have to maintain, I'd love 
to see it in IPython.

Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco

More information about the IPython-user mailing list