From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21572 invoked by alias); 8 Sep 2016 15:34:57 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 39241 Received: (qmail 18466 invoked from network); 8 Sep 2016 15:34:57 -0000 X-Qmail-Scanner-Diagnostics: from mail-qk0-f181.google.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(209.85.220.181):SA:0(0.0/5.0):. Processed in 0.399352 secs); 08 Sep 2016 15:34:57 -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: sgniazdowski@gmail.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _netblocks.google.com designates 209.85.220.181 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=gMN6yjb75rOQrEuazu2DvGpdajaQ9OGqGabvrXFKYCM=; b=li/lKV0JHduTiN8uZ1yM3K3n0RkfU2j2lQv+5piKoMQfOMAbhvFuwr/isy7+gI4w1B R7P7HuPhhotkF1O4LEI9/WaWi0Iy13PP/Yjhc468AjjwHfilDiafOM3QMxnp6KHsttTl xImG8BTjNbmfbTOEuqlyibOSNX/H3l+0jSbOAg4uiPKrjeCKMDOncvM00W8iR/vhG1F1 OTG9WHo1n1JtjPP1qkGpbZ9Dffue4nkexmWGw9vfgmOEbSx5hG8aBQIMIZ+W94e1sHl7 hfVOItCcczGG2sMTeegsc1adIbwKFsi9sk1/ff49CMIR2aD0F7ChTJindlpk3/1YfamG votA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=gMN6yjb75rOQrEuazu2DvGpdajaQ9OGqGabvrXFKYCM=; b=H9OuL/6Fj9n1lAlLlGPwUlFiM0j6iQwzlKeEUFvUVZEH7zjUaRBtdNvGnebWTzzjU9 ly2GOxCVigE8+l7gCQEvx+BR4qQIp2y+ionPEHaCDFTz5BRc71+io66fhtX1YcDsdO/x gcyAEBNTr8GByMRO6jP9cQvBKH87JASdAiR+SPNxMO4eLYhRfvVfWxBAZ4pS4VeeafL1 omuN155wf1KO+SDuCZVD1rmb4QfBFfRQdrxufn6Srhd5YgJsmcX4uL2cqcGJJuTmVt0S TCNP4469rumGecoQgnv6DZq7jx+ddsjGI80+FSdK5gz6HFDih0VSpfgMBfqTeE3i+Kk5 qavA== X-Gm-Message-State: AE9vXwOC2OgSb+uPKf7JO2lAcWmcu/EHPcLpCumUyHtUIXX58dW/Nq8e5FgxoNfGgfoZTiKlzBRoUuxWyDxODQ== X-Received: by 10.55.169.193 with SMTP id s184mr261551qke.3.1473348470756; Thu, 08 Sep 2016 08:27:50 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <20160908121716.GA5468@fujitsu.shahaf.local2> References: <20160908121716.GA5468@fujitsu.shahaf.local2> From: Sebastian Gniazdowski Date: Thu, 8 Sep 2016 17:27:30 +0200 Message-ID: Subject: Re: Could this function (zaccu-process-buffer) be added? To: Daniel Shahaf Cc: Zsh hackers list Content-Type: text/plain; charset=UTF-8 On 8 September 2016 at 14:17, Daniel Shahaf wrote: > > Next time please say in the email itself what the function does. That > would make it easier for your readers to understand your message. > > My understanding is that the function presents an API to ${(z)BUFFER}. > (Correct me if that's inaccurate.) Yes. I included the link as first thing in message, thinking that anyone would just take a look rather than read my message. > > z-sy-h has code that splits the command-line to words with (z) and > tracks indices. I know you know that because you helped optimise it > :-). I don't know which code better solves this problem, z-sy-h's or > zaccu's. The former has not been spun off into a reusable function but > it could be. > > https://github.com/zsh-users/zsh-syntax-highlighting/blob/da60234fb236ccd2b199ffa8a157014dacf4e591/highlighters/main/main-highlighter.zsh#L299-L336 My function is more basic, too bad no one has time to interpret code, even when it's plain simple. The whole thing is around this line: # Remove white spaces buf="${buf##(#m)[^$word[1]]#}" Which removes white spaces also storing them. Rest is careful indexing and decisions whether a word is selected or not, things that make a headache when writing, from what is the value of the function. Best regards, Sebastian Gniazdowski