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

Re: Absolute pathnames similar to expand-cmd-path



On Fri, 28 Jan 2011 22:17:24 +0000
Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx> wrote:
> This tickles cursor positioning annyonances in undo.

An example of what I'm talking about that doesn't need user-defined
widgets:

- type 'echo foo bar'
- move the cursor to 'f'
- delete the next word (Esc d in Emacs mode)
- undo.

You find the cursor at the end of the line.  I contend that you'd
expect it to be on the f.  OK, I state as a fact that that's what I'd
expect and it seems to me the only natural expectation.

We don't update the last cursor position on movement commands, only on
changes.  I *think* the following simple change makes things much
better, to wit, after an undo you get taken back to the cursor
position immediately before the change being undone, rather than where
you made the change before that.

Please say if you see any more oddities with undo, I've been wondering
about this for years and have only just started trying to get to grips
with the undo system.

CVS is still down.  It sounds like it's probably time to move to git
after the next stable release, nobody's suggested replacing it with an
even more trendy system yet...

--- ../zsh-git/zsh/Src/Zle/zle_utils.c	2010-10-05 22:24:01.000000000 +0100
+++ Src/Zle/zle_utils.c	2011-01-29 23:08:45.000000000 +0000
@@ -1085,8 +1085,10 @@ mkundoent(void)
     struct change *ch;
 
     UNMETACHECK();
-    if(lastll == zlell && !ZS_memcmp(lastline, zleline, zlell))
+    if(lastll == zlell && !ZS_memcmp(lastline, zleline, zlell)) {
+	lastcs = zlecs;
 	return;
+    }
     for(pre = 0; pre < sh && zleline[pre] == lastline[pre]; )
 	pre++;
     for(suf = 0; suf < sh - pre &&

-- 
Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/



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