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 39238
- From: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
- To: Sebastian Gniazdowski <sgniazdowski@xxxxxxxxx>
- Subject: Re: Could this function (zaccu-process-buffer) be added?
- Date: Thu, 8 Sep 2016 12:17:16 +0000
- Cc: Zsh hackers list <zsh-workers@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= daniel.shahaf.name; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-sasl-enc:x-sasl-enc; s=mesmtp; bh=WCeFHVkMu58KGIck vNehQq4l9Ek=; b=xlxmT1RBxBDk7nd3vLV2apMDILDhBBdcDoxbbLcSu3uvp4Fz UNaS09hMDkp25dquySMDM2ZN9O2kiaS4IZzB/JRtXm36CjNFlU1u9SvIr9ULzqJm VSlSJnJNFwvLvOLGyDom/U0l3OkS1mp8lEIM8Q1b2mOUU/9gP6qvTEFlTI0=
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-sasl-enc:x-sasl-enc; s=smtpout; bh=WCeFHVkMu58KGIc kvNehQq4l9Ek=; b=s0j4PCutfDRkU4If83y3WKU4cMmgWvWurZ5kdM9MnMwCPCf BZpf+saPA74kUMTeIrDqxqK4H2Wtn/tAMfONhcINCPj2rLoEz5dbCzGxs/rBldYo d1qKKMxUaqMHw0D7WY8LnX5U6zJVyC+RYwwSMRRmBUamXS/l6vSoC8QmxAe0=
- In-reply-to: <CAKc7PVAMiUrTTBOEPmhT5eenN3JBsur3NKtDM3KPCK=dbyf_pQ@mail.gmail.com>
- 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>
Sebastian Gniazdowski wrote on Wed, Sep 07, 2016 at 12:50:03 +0200:
> Hello,
>
> https://github.com/psprint/accumulator/blob/master/zaccu-process-buffer
>
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.)
> I use this function in multiple projects, e.g. here it allows to split
> every line in displayed text and preserve spaces:
>
> https://asciinema.org/a/8k8v5ni5lnnpoc3z5jzl6jgav
>
> I think it provides with precious data. Allows to keep spaces, to address
> words via indexes, carefully selects active word, and also splits it in
> half. If one would want to use bare (z) flag to obtain some of this he
> would have to write control-rich and careful-indexing-rich code, rather a
> headache.
>
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
> I would change namespace and send to ml. One thing – it doesn't deal with
> following, but not a problem for current Zsh:
>
> http://www.zsh.org/mla/workers/2015/msg02570.html
>
The link describes a bug in ${(z)} that was fixed last year. Functions
shipped with zsh 5.3 are not required to be compatible with 5.2.
Cheers,
Daniel
P.S. I noticed that the (z) flag parses «a=() b=() c=() d=()» oddly: the
parentheses are parsed alternately as a single token (INOUTPAR) and as
two tokens (ENVARRAY and OUTPAR).
> Best regards,
> Sebastian Gniazdowski
Messages sorted by:
Reverse Date,
Date,
Thread,
Author