Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Superfluous CRs trouble completion routines in Cygwin
- X-seq: zsh-users 9501
 
- From: Hannu Koivisto <azure@xxxxxx>
 
- To: Zsh Users' List <zsh-users@xxxxxxxxxx>
 
- Subject: Superfluous CRs trouble completion routines in Cygwin
 
- Date: Sat, 15 Oct 2005 13:47:07 +0300
 
- Mail-copies-to: nobody
 
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
 
- Sender: Hannu Koivisto <Hannu.Koivisto@xxxxxxxxxxx>
 
Greetings,
I recently needed to use Perforce both in Windows and Linux (zsh
4.2.4 and 4.2.5, respectively).  Completion worked fine in Linux
but in Windows p4 <tab> caused just an odd "display glitch" instead
of producing a list of p4 commands and their descriptions.  I
immediately suspected that the completion code runs p4 to generate
the completions and is somehow affected by the carriage returns at
the end of lines.  And indeed, when I added hline[-1]=${hline[-1]%^M}
to the loop
_perforce_call_p4 help-commands help commands | while read -A hline; do
    ...
done
the problem disappeared.
That loop collects the commands and their descriptions into an
array which is later passed to _describe.  My modification of
course fixed this particular case, but I can't help thinking there
must be other similar cases in _perforce and probably other
completion functions.  I wonder if it made sense to make the "core"
completion functions such as _describe more tolerant to CRs instead
of modifying application-specific completion functions?  Or can you
think of other, better ways of getting rid of the problem for good?
-- 
Hannu
Messages sorted by:
Reverse Date,
Date,
Thread,
Author