Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Could this function (zaccu-process-buffer) be added?
- X-seq: zsh-workers 39241
- From: Sebastian Gniazdowski <sgniazdowski@xxxxxxxxx>
- To: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
- Subject: Re: Could this function (zaccu-process-buffer) be added?
- Date: Thu, 8 Sep 2016 17:27:30 +0200
- Cc: Zsh hackers list <zsh-workers@xxxxxxx>
- 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==
- In-reply-to: <20160908121716.GA5468@fujitsu.shahaf.local2>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <CAKc7PVAMiUrTTBOEPmhT5eenN3JBsur3NKtDM3KPCK=dbyf_pQ@mail.gmail.com> <20160908121716.GA5468@fujitsu.shahaf.local2>
On 8 September 2016 at 14:17, Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx> 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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author