From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17996 invoked by alias); 22 Mar 2014 15:53:39 -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: 18654 Received: (qmail 11382 invoked from network); 22 Mar 2014 15:53:34 -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=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW, T_TO_NO_BRKTS_FREEMAIL autolearn=ham version=3.3.2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=X15l5xQGmCVIfjjo26gt4OoSMBnLOzkc5Umk6dZtsZM=; b=CADH7FCF2nGU+8QL1XKu12yHpgQ1hOw/8lJDf2SBjlDhT9idTpx+TC3NqQathhZJN5 jD0PLGKtE+YA8PeKi80uQZL7iHRgg/2mi2OUkwsmrZFiK8fFVzzsHdjMd1yoJI82rKJA /HQtztyqnKABaHTe00QT6zwLBgkxSa8wXjC4DVdoawo+txIeCJeKzvfluy6NpkP6eBeM cFUxe/bJowf/vPSHda5fXyRNpM181rscuDfE1+XsZVtm+7RCCQw595LNJSHNWBRPeqJr fkpMq3w67wI/3tOEZbmFJbJSOoA+3t28MP4zCj6ndoI7A5MMdaAi6IE0jkXoZDRIHcV9 0IVQ== X-Received: by 10.15.22.201 with SMTP id f49mr53964120eeu.18.1395497440647; Sat, 22 Mar 2014 07:10:40 -0700 (PDT) Message-ID: <532D99DE.6090503@googlemail.com> Date: Sat, 22 Mar 2014 15:10:38 +0100 From: m0viefreak User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 MIME-Version: 1.0 To: zsh-users@zsh.org Subject: Re: Remove space added by completion References: <16835.1392415885@thecus.kiddle.eu> <20140215004907.GH10654@pug.qqx.org> <140214183336.ZM10372@torch.brasslantern.com> <20140215044539.GA2070@pug.qqx.org> <18441.1392742462@thecus.kiddle.eu> In-Reply-To: <18441.1392742462@thecus.kiddle.eu> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit On 18.02.2014 17:54, Oliver Kiddle wrote: > How about the following? This just uses zparseopts to get the suffixes > and puts them in to each of the alternatives. The trickiest part is > quoting. I've also added a compset -S call to handle an existing suffix. > > Oliver > > diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git > index a2cbf74..cfdbc4f 100644 > --- a/Completion/Unix/Command/_git > +++ b/Completion/Unix/Command/_git > @@ -5526,10 +5526,13 @@ __git_remote_branch_names_noprefix () { > __git_commits () { > # TODO: deal with things that __git_heads and __git_tags has in common (i.e., > # if both exists, they need to be completed to heads/x and tags/x. > + local -a sopts ropt > + zparseopts -E -a sopts S: r:=ropt R: q > + sopts+=( $ropt:q ) > _alternative \ > - 'heads::__git_heads' \ > - 'commit-tags::__git_commit_tags' \ > - 'commit-objects::__git_commit_objects' > + "heads::__git_heads $sopts" \ > + "commit-tags::__git_commit_tags $sopts" \ > + "commit-objects::__git_commit_objects" > } > > (( $+functions[__git_heads] )) || > @@ -5595,10 +5598,12 @@ __git_commits2 () { > > (( $+functions[__git_commit_ranges] )) || > __git_commit_ranges () { > + local -a suf > if compset -P '*..(.|)'; then > __git_commits $* > else > - __git_commits $* -qS .. > + compset -S '..*' || suf=( -qS .. -r '.@~ ^:' ) > + __git_commits $* $suf > fi > } > > While this works great when completing something *after* a branch name, such as $ git log foobar which then ends up in $ git log foo-branch..bar-branch this new suffix behavior is pretty bad in the following case: $ git log ma It ends up executing the following: $ git log master.. The expected result (and behavior before this change) is: $ git log master which is something else entirely. For some reason the auto-removable suffix does not get removed when accept-line is called. Is there a reason for this or a way to fix this? Or a way to disable the newly introduced .. suffix entirely? I'd rather hit backspace and add the dots myself when I actually want them instead of having to remove them when they are inserted automatically.