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

Re: Unexpected behavior for completion funcion _remote_files()



Oliver Kiddle wrote on Mon, Sep 12, 2016 at 17:30:15 +0200:
> On 6 Sep, Daniel Shahaf wrote:
> > > +  args=( ${argv[1,(I)--]} )
> >
> > Should be (i), not (I), in case the [<cmd options>] themselves contain
> > a '--' word.
> 
> I had intentionally used (I) to cope with the case where there is no
> '--' on the line at all.
> 
> This should handle either case.
> 
> Oliver
> 
> diff --git a/Completion/Unix/Type/_remote_files b/Completion/Unix/Type/_remote_files
> index 54bd438..dbfb561 100644
> --- a/Completion/Unix/Type/_remote_files
> +++ b/Completion/Unix/Type/_remote_files
> @@ -38,9 +38,9 @@ if zstyle -T ":completion:${curcontext}:files" remote-access; then
>    zparseopts -D -E -a args / g:=glob h:=host
>    (( $#host)) && shift host || host="${IPREFIX%:}"
>  
> -  args=( ${argv[1,(I)--]} )
> +  args=( ${argv[1,(i)--]} )
>    shift ${#args}
> -  args[-1]=()
> +  [[ args[-1] = -- ]] && args[-1]=()

In latest master, scp behaves as follows:

% scp foo:<TAB>
-J         -d         -default-  remdispd   remdispf

It bisects to the patch I'm replying to (98581594b50d == 39295).

This is the behaviour regardless of whether 'foo' is a valid hostname or
not.

Cheers,

Daniel

>    # Command to run on the remote system.
>    cmd="$1"
>    shift
> 



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