From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3241 invoked by alias); 21 Sep 2014 20:38:03 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 19128 Received: (qmail 15443 invoked from network); 21 Sep 2014 20:37:53 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, RCVD_NUMERIC_HELO,SPF_HELO_PASS,T_FSL_HELO_BARE_IP_2 autolearn=no version=3.3.2 X-Injected-Via-Gmane: http://gmane.org/ To: zsh-users@zsh.org From: Yuri D'Elia Subject: Re: rsync --progress stops completion Date: Sun, 21 Sep 2014 22:37:37 +0200 Message-ID: References: <2002755.9ryFYYVtTN@note> <5418786F.8030001@thregr.org> <140916175124.ZM5742@torch.brasslantern.com> <54194198.2010607@thregr.org> <140917085133.ZM6725@torch.brasslantern.com> <541AA918.8060503@thregr.org> <140918093602.ZM7963@torch.brasslantern.com> <140918190130.ZM8366@torch.brasslantern.com> <140920112024.ZM29459@torch.brasslantern.com> <140921102006.ZM31805@torch.brasslantern.com> <140921123854.ZM1299@torch.brasslantern.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 193.106.183.18 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.0 In-Reply-To: On 09/21/2014 10:27 PM, Yuri D'Elia wrote: > Any obvious problems you can spot? And as I say it, an obvious tweak: only enable the fallback if we're attempting to complete a new word. This prevents the fallback to be triggered if we're attempting to complete a bad argument/file name. #autoload local -a _complete_fallback_precmd _complete_fallback_cleanup() { precmd_functions=_complete_fallback_precmd _complete_fallback_precmd=() } _complete_fallback() { if [[ -n $_complete_fallback_precmd || ( $LASTWIDGET = *complete* && -z $words[$CURRENT] ) ]] then if [[ -z $_complete_fallback_precmd ]] then _complete_fallback_precmd=precmd_functions precmd_functions+=( _complete_fallback_cleanup ) compadd -x "fallback: enabled" return 0 fi [[ $compstate[context] = command && $CURRENT -gt 2 ]] || return 1 words=("$words[1]" "${(@)words[$CURRENT,-1]}") CURRENT=2 _compskip=default _complete fi } _complete_fallback "$@"