zsh-users
 help / color / mirror / code / Atom feed
From: Ray Andrews <rayandrews@eastlink.ca>
To: zsh-users@zsh.org
Subject: Re: coloring a substitution
Date: Tue, 8 Nov 2022 15:49:43 -0800	[thread overview]
Message-ID: <1b44b09a-ebae-a45d-a19d-c83e1ce68f65@eastlink.ca> (raw)
In-Reply-To: <CAN=4vMqMsigw20xAdLGcTNmTVKWe4chtFRWLdcXdXS4zQR_Q2w@mail.gmail.com>


On 2022-11-08 13:10, Roman Perepelitsa wrote:

> - `print` is equivalent to `print -r --` here 
Right!  It's one of those things that's easy to overlook until some 
weird name bites you.
>
>    recent[$aa]=${recent[$aa]//(#i)$filter/$'\e['$color';1m'$filter$'\e[0m'}

Therewego, > $'\e[' < replaces  > \x1b\[ <.

Thanks Roman.

BTW as it stands now my filtering issue on the other thread:

For globbing for files on the disk: ($zsh_case = '(#i)'):

     [ "$wild_msg" = 'WILD' ] \
                 && eval "wholedisk=( $zsh_case/**/*$1*(/N) )" \
                 || eval "wholedisk=( $zsh_case/**/$1(/N) )"

For string searches in the directory stack:

for (( aa = 1; aa <= $#cc; aa++ )); do

# These are full names, $1 may be only a partial match if we are WILD.
dirname=${cc[$aa]:t}

if [[ "$scope_msg" = 'BROAD'                  && $dirname = (#i)*$1* ]] \
|| [[ "$scope_msg" = 'Case INsensitive TAME' && $dirname:u = $1:u ]] \
|| [[ "$scope_msg" = 'Case Sensitive WILD'      && $dirname =~ $1 ]] \
|| [[ "$scope_msg" = 'EXACT'                  && $dirname = $1 ]]; then 
; # Do nothing, we have a match.
else cc[$aa]=    # Kill the line, it does not match.
fi
done

... any further improvements?

> Roman.
>


  reply	other threads:[~2022-11-08 23:50 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-08 20:56 Ray Andrews
2022-11-08 21:10 ` Roman Perepelitsa
2022-11-08 23:49   ` Ray Andrews [this message]
2022-11-09  0:11     ` Bart Schaefer
2022-11-09  0:32       ` Ray Andrews
2022-11-09  8:19     ` Roman Perepelitsa
2022-11-11 22:24       ` Ray Andrews
2022-11-11 22:39         ` Roman Perepelitsa
2022-11-12  3:36           ` Ray Andrews

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=1b44b09a-ebae-a45d-a19d-c83e1ce68f65@eastlink.ca \
    --to=rayandrews@eastlink.ca \
    --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).