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

Re: PATCH: bash-transpose-words

On Jul 20, 11:49am, Peter Stephenson wrote:
} Now what I'd really like is for the cursor to stay at the point [...]
} with marks --- which I still don't trust if text has been moving around,
} but I haven't analysed what I don't trust well enough to suggest what needs
} fixing.

The mark in zsh is just an offset in $BUFFER.  In emacs it (effectively)
is a zero-width pseudo-character located between two real characters.
That means you can move stuff around the mark in emacs and it shifts left
or right along with the unchanging characters adjacent to it.  In zsh,
this effect is sometimes mimicked by (in|de)crementing the mark position
as characters are (inserted|deleted), but it is not done consistently.

So given this text:

        echo abcdefg dcba
                     cursor and mark both here

In emacs, after transpose-words:

        echo dcba abcdefg
                  cursor and mark both here (moved with the space)

But in zsh:

        echo dcba abcdefg
                     mark here (same buffer offset), cursor at end

Sven and I had a discussion a while back about the difficulty of keeping
the mark consistent when one can do wholesale assignments to $BUFFER
without passing through the usual zle functions.  It was inconclusive.

Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   

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