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

Re: Could this function (zaccu-process-buffer) be added?



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