Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Id: Zsh Workers List <zsh-workers.zsh.org>
List-Post: <mailto:zsh-workers@zsh.org>
List-Help: <mailto:zsh-workers-help@zsh.org>
X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au
X-Spam-Level: 
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham
	autolearn_force=no version=3.4.1
Date: Thu, 02 Jun 2016 13:28:35 +0000
From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: Zsh hackers list <zsh-workers@zsh.org>
Cc: Hong Xu <hong@topbug.net>
Subject: Re: Feature request: readline's completion-prefix-display-length
 option
Message-ID: <20160602132835.GA32034@tarsus.local2>
References: <5738124C.7020705@topbug.net>
 <CAH+w=7aYcxp73F2koe1nVBRMR8jwJ5eYLAyMi2_35FEX9=dJXw@mail.gmail.com>
 <20160519211427.GA11264@tarsus.local2>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <20160519211427.GA11264@tarsus.local2>
User-Agent: Mutt/1.5.23 (2014-03-12)
X-Seq: zsh-workers 38575

Daniel Shahaf wrote on Thu, May 19, 2016 at 21:14:27 +0000:
> Bart Schaefer wrote on Sun, May 15, 2016 at 04:50:50 -0700:
> > On Sat, May 14, 2016 at 11:08 PM, Hong Xu <hong@topbug.net> wrote:
> > >
> > > I believe that readline's completion-prefix-display-length is a great
> > > option to have for zle. This option enables the common part of long
> > > completions to be represented by ellipsis, so the options in the
> > > completion list would not be too long in many cases.
> > 
> > There might be a deviously clever way to do this with the list-colors
> > style, similar to the way that show-ambiguity is implemented.
> 
> Like this?

I've added a guard and made minor tweaks:

if [[ $'\e\x5b3D' == "$(echoti cub 3)" ]] &&
   [[ $'\e\x5b33m' == "$(echoti setaf 3)" ]]; then
  zstyle -e ':completion:*' list-colors $'reply=( "=(#b)(${(b)PREFIX})(?)([^ ]#)*=0=0=${PREFIX:+${#PREFIX}D${(l:$#PREFIX:: :):-…}\e\x5b}34=33" )'
fi
zstyle ':completion:*:*(directories|files)*' list-colors ''

