From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10918 invoked by alias); 21 Sep 2014 20:27:57 -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: 19127 Received: (qmail 26250 invoked from network); 21 Sep 2014 20:27:44 -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:27:26 +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: <140921123854.ZM1299@torch.brasslantern.com> On 09/21/2014 09:38 PM, Bart Schaefer wrote: > You might be better off using "compadd -x" to display a message, but > that only shows up if there's a completion listing. Hmm. After some testing, I got this: #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* ]] 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 "$@" === When the hook is added, I display a message and then stop to make it readable, as otherwise it's obliterated by the completion list. Felt a bit odd in the beginning, since you need to press tab *again*, but it gives you a chance to just accept/cancel the command if you're in doubt. I like the behavior, as it makes obvious that the completion broke at that point. I also removed the local curcontext, since after _complete_fallback_precmd is set, the context is already :completion::complete-fallback:* due to the fact that _complete_fallback is immediately entered. Any obvious problems you can spot?