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

Re: "drop-in replacement" and transpose-words-match

On Jan 18,  6:04pm, Sebastian Gniazdowski wrote:
} My point is: isn't it that sticking to LBUFFER is the source of
} various problems? Its use is always more or less hackish and has
} effects like "you should position cursor on beginning of a word to
} swap it". Implementation generates features while it should be the
} opposite.

Sorry, I can't agree.  By *FAR* the most common editing operation is
to either either insert or delete to the left of the cursor position,
which means at the end of LBUFFER.

Furthermore, zew-process-buffer always manipulates whatever the (z)
flag's idea of a "word" is, which [as the "bufferwords()" thread has
demonstrated] is somewhat tenuously defined, and may not correspond
to what the user wants to consider a "word" (see e.g. $WORDCHARS).

[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.]

Messages sorted by: Reverse Date, Date, Thread, Author