Subject: Re: yank-pop broken in current dev zsh?
From: Oliver Kiddle <[email-masked]>
To: [email-masked]
Date: Wed, 13 Apr 2016 23:01:03 +0200
List-Id: Zsh Workers List <zsh-workers.zsh.org>

On 11 Jan, Bart wrote:
> with "thre" highlighted and the cursor on the final "e".  The cursor should
> be after the entire word "three", should it not?  The whole "three" is then

> I suppose this might be related to the CURSOR increment I mentioned needing
> following select-in-shell-word in a widget.

That's more-or-less exactly what the issue is. There was a cursor
correction in there that should only be there for vi command-mode. Does
things seem right in emacs mode with the following fix?

In many cases we compare zlecs to findbol() for the correction but I
don't think that would be correct in this case.

diff --git a/Src/Zle/zle_misc.c b/Src/Zle/zle_misc.c
index 25f65b3..a040ca0 100644
--- a/Src/Zle/zle_misc.c
+++ b/Src/Zle/zle_misc.c
@@ -597,7 +597,7 @@ static void pastebuf(Cutbuffer buf, int mult, int position)
 	    zlecs += cc;
 	}
 	yanke = zlecs;
-	if (zlecs)
+	if (zlecs && invicmdmode())
 	    DECCS();
     }
 }