Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: coloring substitution seems to eat next line.

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:


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