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

Re: Match to the end of string when using (S) flag



One solution can be:

local nul=$'\0'
region_highlight+=( "${(0)${(S)text//*(#bi)(${~colsearch_pattern})/$((
offset + mbegin[1] - 1 )) $(( offset + mend[1] ))
${__hsmw_hl_color}${nul}}%$nul*}" )

however user probably can enter or somehow have in history a null byte?
That said, the solution is rather acceptable. Generates clean
region_highlight entries and in emergency case of a null byte in $text
after last match – relies on Zshell's robust region_highlight
implementation converting improper entries to "-1 -1 none". Provided
there is no other way, this is fine. But maybe there is other way?

-- 
  Sebastian Gniazdowski
  psprint@xxxxxxxxxxxx



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