From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16859 invoked by alias); 1 Nov 2016 16:27:58 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 22062 Received: (qmail 21108 invoked from network); 1 Nov 2016 16:27:58 -0000 X-Qmail-Scanner-Diagnostics: from new2-smtp.messagingengine.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(66.111.4.224):SA:0(0.0/5.0):. Processed in 0.32345 secs); 01 Nov 2016 16:27:58 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=FREEMAIL_FROM,SPF_PASS, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.1 X-Envelope-From: psprint@fastmail.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at spf.messagingengine.com designates 66.111.4.224 as permitted sender) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=fastmail.com; h= content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc:x-sasl-enc; s=mesmtp; bh=9e7dB6NnhOCOKlt aXGZwDEpJD4I=; b=wWZYDMBu7Pnr7A8xq/r6wij6Aeuc4/YaTLUSmStAa9fz17p 5nbvuQ6iY6fGi6O5S2WgxxNlSqvcKtsYsgr+e2Y5sMAStzyvZS2MfxtYXGFLJxhU 9m3tVovIcq5Lg/1BfywDP90wx5E3SM0vfsPWOKejyLaMgue31hNjCrmPZEsQ= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s= smtpout; bh=9e7dB6NnhOCOKltaXGZwDEpJD4I=; b=DuxVONc1BswGjR9PFSY2 Mectp8bGtAIATgJtY65yGyhNdKEsyHoxiRCapWZX8IL+gyRJxISqhSsd8YZhNkOI 7GpkylbinSQonxIpdHpa31VtXiVnKnfC54yNMu1qfBmR2KWEMkq/69J6jv41zEfz G4HF+QoyQne5KikPMgJnCHI= X-ME-Sender: Message-Id: <1478017673.3085741.773974873.7C58DD0B@webmail.messagingengine.com> X-Sasl-Enc: wdFK6VeiPwTwoDzrFnBr7q8x/o2cqY2uuY7YK9iZ/+7P 1478017673 From: Sebastian Gniazdowski To: zsh-users@zsh.org MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" X-Mailer: MessagingEngine.com Webmail Interface - ajax-996895c6 Subject: Re: Match to the end of string when using (S) flag Date: Tue, 01 Nov 2016 09:27:53 -0700 In-Reply-To: <1478010333.3056500.773811025.1AAA4FEC@webmail.messagingengine.com> References: <1478010333.3056500.773811025.1AAA4FEC@webmail.messagingengine.com> One solution can be: local nul=3D$'\0' region_highlight+=3D( "${(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 =E2=80=93=C2=A0relies 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? --=20 Sebastian Gniazdowski psprint@fastmail.com