Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

bug in 3.1.4 completion



Hi,

I have found a minor bug in zsh 3.1.4 completion related to the
automagic removal of completed slashes.  If I invoke zsh -f, 

% mkdir test
% cd test
% mkdir foo
% mkdir foo/bar foo/barbaz

% ls f               ; now type TAB
  -> foo/            ; now type TAB
  -> foo/bar         ; now type SPACE
  -> foo/ba          ; notice the "r" got removed.

This only seems to happen if you complete "foo" then
immediately hit TAB again.  If you type part of "bar" and
then TAB it functions correctly.

While I'm at it I have a few other nits about the completion system
(which on the whole I think is excellent).

First, another somewhat inconvenient behavior related to slash removal
(again zsh -f, and with the same directories created above):

% ls fo bar      ; position the cursor on the space after the "o", hit TAB
  -> foo/ bar    ; now, the cursor is still on the space after the "/".
                 ; hit Control-d to delete the space 
  -> foo/bar     ; with cursor on "b".  now Control-e (end-of-line) and
  -> foobar      ; the "/" gets removed.  ugh.

                
Another behavior that's not quite right IMHO is completeinword:

% setopt noalwaystoend completeinword
% ls fo/bar         ; position cursor on "/", hit TAB
  -> foo/bar/       ; hit TAB again
  -> foo/bar//      ; hit TAB again
  -> foo/bar///     ; etc, never listing possible completions

Even if I move past the "/", or even "b" it never jumps to the end of
"bar".  Setting alwaystoend helps, though it is still very picky about
the stuff on both sides matching, which often makes the feature
useless.  I have modified emacs to do what I believe is the right
thing:

   * look for completions using both text on left and right.
     if there are none, look only for completions from the left.  this 
     way having some garbage on the right doesn't hose you, it just
     gets pushed right (it may match later, after more completing).
   * now, insert the completed text, placing cursor at the end of the
     insertion.
   * remove the longest substring to the right (with start anchored at
     the cursor) which matches a substring to the left (with end
     anchored at the cursor).  there may be none.

How hard would it be to add this to zsh?

While I'm on little nits, it would be nice if the FIGNORE variable
were not used when listing completions:

% FIGNORE='.o'
% touch foo.o foo.c
% ls fo      ; type Control-d to list completions, you only see "foo.c"

One last feature that'd be nice is automatic case conversion.  When
completing, if no completions are found, try again for a case
insensitive completion.  Would this be easy to add?


Please CC me in replies, I am not on the list.

many thanks,
Greg




Messages sorted by: Reverse Date, Date, Thread, Author