zsh-users
 help / color / mirror / code / Atom feed
From: Tomasz Pala <gotar@polanet.pl>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: Zsh Users <zsh-users@zsh.org>
Subject: Re: _complete: insert unambiguous when globbing
Date: Thu, 6 Jan 2022 11:38:19 +0100	[thread overview]
Message-ID: <20220106103818.GA10722@polanet.pl> (raw)
In-Reply-To: <20220106015221.GA12608@polanet.pl>

On Thu, Jan 06, 2022 at 02:52:21 +0100, Tomasz Pala wrote:

>> unsetopt globcomplete
>> zstyle ':completion:*' completer _complete _match _expand
>> zstyle ':completion::match:*' insert-unambiguous true
> 
> Smart one! This is nice, but this time I got other issues:
> 
> $ rpm --*er[tab]
> 
> without glob_complete, this method of finding options for SOME commands
> stops working. What's the difference between ps --* and ls --* that the
> latter still works?

This is weird - it's broken only when both styles are set:

zstyle ':completion:*:descriptions' format '%B%d%b'
zstyle ':completion:*:messages' format ':%d'

> And back to my example:
> 
> $ touch 2021.12.29-14:41:02.xz 2021.12.29-19:41:02.xz 2021.12.30-03:41:03.xz 2021.12.30-14:41:04.xz 2021.12.30-19:41:02.xz 2021.12.31-03:41:02.xz 2021.12.31-14:41:04.xz 2021.12.31-19:41:03.xz
> $ ls *04[tab]
> - this one is much nicer than my version, goes directly to:
> $ ls 2021.12.3-14:41:04.xz		(note the suffix)
> with cursor __^__ placed here, on dash. However, unless I move cursor
> left+right manually, pressing tab second time moves cursor to the end
> with uncompletable line...

This exposes some general issue - I don't know which part inserts
unambiguous SUFFIX into the ZLE, but obviously it should be done only
when completeinword is set.

> And following one fails miserably...
> $ ls *z[tab]
> $ ls 2021.12.-
> 
> See the dash at the end? From now on, no completion... This problem is

This is probably some deeper bug somewhere, still happens with --norcs
followed by settings from this thread.

> There is still one issue with coloring completions, that works fine with
> my approach, but seems to be stuck on _oldlist:
> 
> highlights='${PREFIX:+=(*/|)(#bi)($PREFIX|$PREFIX:t)(?)(*(${LASTSEARCH})*)#*==1;32=1;31==1;32}':${(s.:.)LS_COLORS}
> zstyle -e ':completion:*:*' list-colors 'reply=( "'$highlights'" "ma=44;1;33")'
> 
> With _oldlist in action the colors are not updated after prepending the
> unambiguous part.

In my solution compstate[old_list]=keep is set on second tab strike and
the colors are recalculated at this point; is it because this is done
AFTER "# Stuff we always do to clean up" which restores ZLS_COLORS?
Any way to simulate this for _oldlist?


And one more final note - I said all of those sacrifice pattern from ZLE
(which might get people angry if they loose some hand-crafted fine-tuned
one and are unfamiliar with undo), however without globcomplete this
pattern is also lost.

-- 
Tomasz Pala <gotar@pld-linux.org>


  reply	other threads:[~2022-01-06 10:39 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-03 12:39 Tomasz Pala
2022-01-03 15:40 ` Tomasz Pala
2022-01-04  0:25 ` Bart Schaefer
2022-01-05 19:46   ` Tomasz Pala
2022-01-05 20:11     ` Bart Schaefer
2022-01-06  1:52       ` Tomasz Pala
2022-01-06 10:38         ` Tomasz Pala [this message]
2022-01-05 20:15     ` Tomasz Pala
2022-01-05 20:25       ` Bart Schaefer

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=20220106103818.GA10722@polanet.pl \
    --to=gotar@polanet.pl \
    --cc=schaefer@brasslantern.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).