[IPython-dev] tab completion w/ spaces in filename - still broken
Fernando.Perez at colorado.edu
Wed Jun 30 17:03:46 EDT 2004
Ville Vainio wrote:
> Fernando Perez wrote:
>>readline to keep the whole filename intact for completion. So we have
>>a partial fix, but a full solution will require a real readline guru
>>(it may not be possible with python's readline, I don't know: I'm not
>>sure if python's readline exposes all of GNU readline).
> readline.get_line_buffer(), which gets the whole line, might be usable
> for this, together with readline.get_endidx(). I imagine that the
> completion function could move left enough to find the first "real",
> i.e. unescaped delimiter to find the real start position (and hence the
> real completable text).
Except that readline.get_line_buffer() doesn't work. It blocks in a truly
bizarre manner (at least on my box). I tried putting calls to it inside the
file_complete() method, and they go into a black hole. I can't play much with
this now, but that was exactly my thought. If you can get it to work, great,
otherwise I might look at it again this weekend.
But the behavior was really strange, to the point that I'm thinking that
routine may actually be buggy in the standard lib. Try calling it and just
printing its output, I couldn't even get _any_ i/o to work after calling it.
I tried printing normally, to stderr, and even diverting out to a file on disk
in case readline was hijacking stdout/err. All to no avail: even my file
ended up empty, regardless of what I printed to it.
More information about the IPython-dev