darcs patch: Use command-dependent word break characters for
tab completion in ghci. Fixes bug #998.
simonmarhaskell at gmail.com
Thu Jan 10 05:30:07 EST 2008
Simon Marlow wrote:
> Judah Jacobson wrote:
>> The attached patch fixes bug #998 (tab completion of filenames in
>> subdirectories doesn't work in ghci).
>> * Use command-dependent word break characters for tab completion in
>> ghci. Fixes bug #998.
>> M ./compiler/ghci/GhciMonad.hs -1 +1
>> M ./compiler/ghci/InteractiveUI.hs -59 +83
>> I had originally looked at this problem last year and thought that it
>> would require additional readline functionality. However, this patch
>> fixes the problem without using any more readline APIs than before.
>> (This is partly motivated by the possibility of using libedit on OS
>> I've tested this patch against HEAD, but it should work on the stable
>> branch as well.
> Excellent, thanks. I'll review and apply.
I've found one small problem: it doesn't seem to cope with absolute paths
(those beginning with /) very well.
Prelude> :e /tmp<TAB>
for me it just adds a space after /tmp, rather than a slash. That is,
unless the current directory has a "tmp" subdirectory... very strange.
After further investigation... I think this is something readline itself is
doing. The completion code in GHCi appears to be doing the right thing,
but readline appears to have some special code to handle filenames, e.g.
Prelude> :cd /
even though GHCi isn't asking for filename completion here. In fact
readline has to do something special, because when completing filenames it
has to know whether the current word is a directory, to add the slash, and
it's probably using the wrong word-break characters. So perhaps the only
way to get this right is to really change readline's idea of the word-break
More information about the Cvs-ghc