* Superfluous CRs trouble completion routines in Cygwin
@ 2005-10-15 10:47 Hannu Koivisto
2005-10-15 18:02 ` Bart Schaefer
0 siblings, 1 reply; 2+ messages in thread
From: Hannu Koivisto @ 2005-10-15 10:47 UTC (permalink / raw)
To: Zsh Users' List
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Superfluous CRs trouble completion routines in Cygwin
2005-10-15 10:47 Superfluous CRs trouble completion routines in Cygwin Hannu Koivisto
@ 2005-10-15 18:02 ` Bart Schaefer
0 siblings, 0 replies; 2+ messages in thread
From: Bart Schaefer @ 2005-10-15 18:02 UTC (permalink / raw)
To: Hannu Koivisto, Zsh Users' List
On Oct 15, 1:47pm, Hannu Koivisto wrote:
}
} [...] 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.
The underlying issue here is the one discussed in the thread "Little
problem while converting from bash" back on May 12 (e.g. users/8822).
There was also a lengthy thread "zsh and line breaks" in April 2004
on the zsh-workers list which partly explains how we got to where we
are now.
} 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?
I think the answer is that $_comp_setup in compinit should contain
local IFS=$'\r'"$IFS"
The question is whether it would hurt to treat CR as whitespace in
completion on other platforms -- if it would, then we need to make
that conditional on Cygwin, somehow.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2005-10-16 7:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-10-15 10:47 Superfluous CRs trouble completion routines in Cygwin Hannu Koivisto
2005-10-15 18:02 ` Bart Schaefer
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).