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

Re: coloring substitution seems to eat next line.




On 2022-11-10 10:36, Roman Perepelitsa wrote:
Does that matter? I thought it was one of those situations where the
dollar sign is optional.
It matters if cc is an associative array. Given that you've
(accidentally) used slice assignment with cc, it cannot be an
associative array.
Correct.  Anyway that's good to know, I think I've only used an associative array once and not here.

I've never heard of slice assignment :(
These two aren't the same:

   cc[42]="foo bar"
   cc[42]=(foo bar)

The second is a slice assignment.
Ok, I'll play with that.  Sheesh, the things I don't even know that I don't know.  Is there somewhere I can read up on that?
You can filter beforehand like this:
   cc=(${(M)cc:#*$filter*})

This assumes that $filter doesn't have metacharacters. If it does and
you want to treat them as such, use $~filter.
Thanks, I'll tinker with that.  It will be satisfying to be able to avoid sed ... come to that I just went back to grep for the filter and colorization because sed's separation character might just be part of a directory name.  These little things! grep is faster too. But native code will be best.

Roman.





Messages sorted by: Reverse Date, Date, Thread, Author