[IPython-dev] Using pyreadline by default

Jörgen Stenarson jorgen.stenarson at bostream.nu
Tue Jul 8 13:14:41 EDT 2008


Stéfan van der Walt skrev:
> 2008/7/8 Fernando Perez <fperez.net at gmail.com>:
>> As Jorgen mentioned, the problem is that pyreadline currently only
>> implements the full line-handling functionality you'd want under win32
>> (by accessing the console APIs).  Under osx/linux, you'd be stuck
>> without any actual line handling support, unless I'm not understanding
>> what you are trying to do.
> 
> Oops, I missed that part.
> 
>> By the way, isn't it easier for what you want to just define your own
>> $PAGER environment variable?  You can even do it for ipython only by
>> making the change in your config file.
> 
> Unfortunately, that doesn't help: the pager is not used for tab completion.
>

You are right right, now in pyreadline there is a _display_completions 
method which just dumps all the matches to the screen. Which means there 
is no check of the $pager variable. I'm not even sure it is a good idea 
if we want to use the code for guis.

The problem with the current approach is that it is at the moment 
hardcoded to use the console. Which means nothing will be shown if you 
try to use it in a gui. There are at least one more function 
(clear_screen) that talks directly to the console and thus does not work 
in a gui. Ideally the completions as well as the request for a 
clear_screen should be propagated to the calling function that 
implements the drawing. I have not decided yet how this is done best.

/Jörgen



More information about the IPython-dev mailing list