Readline and unwanted filename completion

Simon Budig Simon.Budig at unix-ag.org
Fri Feb 1 19:00:31 EST 2002


Michael Hudson <mwh at python.net> wrote:
> Simon Budig <Simon.Budig at unix-ag.org> writes:
>> Something is broken with the completion of readline:
> 
> The more I learn about readline, the less I like about it.  Not that
> I'd want to live without it, of course.

Heh - add ncurses to that list...   :-)

>> It seems that readline has a fallback to filename completion when
>> no matches are available. Even if I use my own completion function:
>> 
>> >>> def nullcompleter (text, state):
>> ...    print "\nBuh!"
> 
> <aside>
> That's probably a bad idea; you have no idea what state the terminal
> will be in when this function gets called...
> </aside>

Yeah -  I think so too, but it seems to work Ok and it helped me
to understand when the custom function gets called...

[...]
>> Is this a known Problem? 
> 
> Well, I knew about it.  I don't regard it as a huge problem.

Hmm. Imagine you are writing an interactive interpreter of a
custom language to manipulate something non-file'ishes and
suddenly the commandline starts completing *filenames*. I
think this is a good showstopper...

>> Is there an evil hack to avoid this?
> 
> Dunno.  Doubt it, somehow.  You'll need to look at the documentation
> for readline, though.

Well - I looked at the documentation for the readline-module, but that
doesn't say anything about it. Maybe I should read the sources.

Oh well. I am currently a little bit clueless...
        Simon
-- 
      Simon.Budig at unix-ag.org       http://www.home.unix-ag.org/simon/



More information about the Python-list mailing list