zsh-users
 help / color / mirror / code / Atom feed
From: m0viefreak <m0viefreak.cm@googlemail.com>
To: zsh-users@zsh.org
Subject: Re: Remove space added by completion
Date: Sat, 22 Mar 2014 15:10:38 +0100	[thread overview]
Message-ID: <532D99DE.6090503@googlemail.com> (raw)
In-Reply-To: <18441.1392742462@thecus.kiddle.eu>



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 foo<tab>bar<tab>

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<tab><return>

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.


  parent reply	other threads:[~2014-03-22 15:53 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-14 21:42 zzapper
2014-02-14 22:11 ` Oliver Kiddle
2014-02-15  0:49   ` Aaron Schrab
2014-02-15  2:33     ` Bart Schaefer
2014-02-15  4:45       ` Aaron Schrab
2014-02-18 16:54         ` Oliver Kiddle
2014-02-20  1:33           ` Aaron Schrab
2014-03-22 14:10           ` m0viefreak [this message]
2014-03-22 16:43             ` [PATCH] _git: auto-removable '..' suffix: remove at the end of lines m0viefreak
2014-03-22 17:37               ` Bart Schaefer
2014-03-23  3:41                 ` m0viefreak
2014-03-23  6:45                   ` Bart Schaefer
2014-03-23 18:38                     ` [PATCH] zle/completion: fix auto-removable suffix highlighting m0viefreak
2014-02-15 12:45   ` Remove space added by completion zzapper
2014-02-20 10:05     ` Oliver Kiddle

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=532D99DE.6090503@googlemail.com \
    --to=m0viefreak.cm@googlemail.com \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).