Subject: Re: "drop-in replacement" and transpose-words-match
From: Sebastian Gniazdowski <[email-masked]>
To: Bart Schaefer <[email-masked]>
Cc: Zsh hackers list <[email-masked]>
Date: Tue, 19 Jan 2016 09:28:37 +0100
List-Id: Zsh Workers List <zsh-workers.zsh.org>

On 19 January 2016 at 07:31, Bart Schaefer <[email-masked]> wrote:
> [I would probably save CURSOR and MARK, set CURSOR to zero, then loop
> on "zle forward-word" until I reached or passed the old CURSOR, rather
> than try to match up the results of (Z:n:) to $BUFFER.  Then restore
> CURSOR and MARK, of course.]

This would miss spaces. zew-pb remembers white space before each word.
This allows to preserve them when rebuilding buffer after e.g. word
swapping

I'm now writing a shell division function that would be used instead
of pure (Z+n+), in zew-pb. The point is to have a meaningful word
division in case if user enters '$(( 0 + 1 abc $(( 0 + 2' and tries to
complete after '$(( 0 + 1' or '$(( 0 + 2'. A tedious task, will call
(z) in number slightly greater than number of letters. My point is
that Zsh could provide more information (besides LBUFFER) to Zle and
compsys, and also zsh-syntax-highlighting. Not completely sure yet
what the information should be.

Zsh-syntax-highlighting can be slow, which can be seen by editing ~400
lines function with zed -f. Maybe it's because it's doing various
things to compensate not that rich information provided by Zsh.

Best regards,
Sebastian Gniazdowski