Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: coloring substitution seems to eat next line.
- X-seq: zsh-users 28357
- From: Ray Andrews <rayandrews@xxxxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Re: coloring substitution seems to eat next line.
- Date: Thu, 10 Nov 2022 10:25:26 -0800
- Archived-at: <https://zsh.org/users/28357>
- In-reply-to: <CAN=4vMp6wFY5MG5dOgWRTqc3W1OvhKsU=bbWZyR=yZgNKt3rRw@mail.gmail.com>
- List-id: <zsh-users.zsh.org>
- References: <c87afbb9-d8d1-1d9f-09a3-0e4172fe080f@eastlink.ca> <CAN=4vMp6wFY5MG5dOgWRTqc3W1OvhKsU=bbWZyR=yZgNKt3rRw@mail.gmail.com>
On 2022-11-10 00:02, Roman Perepelitsa wrote:
Differences in the second version compared to the first:
Sorry about the sloppy code Roman, the differences there don't matter
but you have no way of knowing that.
- aa instead of $aa
Does that matter? I thought it was one of those situations where the
dollar sign is optional.
- slice assignment instead of scalar (almost certainly unintended)
Indeed. I don't even know what the difference is. I've never heard of
slice assignment :(
Given that the second version works without errors
The first version using sed.
This means you can replace
the whole loop with this:
local MATCH MBEGIN MEND
cc=(${cc//(#m)$~zsh_case$filter/$'\e[31;1m'$MATCH$'\e[0m'})
Unfortunately not. That works as you intend, but I need to filter not
just colorize. Any line without all matches must be deleted. The 'for'
loop runs the lines thru each filter in turn and must zero any line that
does not match.
You can debug this by printing all relevant parameters.
print -r -- "going in: $cc[aa]"
typeset -p cc aa filter
Good idea! That's going to be useful.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author