summary refs log tree commit diff
path: root/Src/Zle/zle_vi.c
diff options
context:
space:
mode:
authorBarton E. Schaefer <schaefer@zsh.org>2014-10-29 08:49:33 -0700
committerBarton E. Schaefer <schaefer@zsh.org>2014-10-29 08:49:33 -0700
commit9d2cfa7af6b8973e13716f7c36f7fb156e3348dd (patch)
treec3eb8ee16917b822f908f37653796f4aa31b5648 /Src/Zle/zle_vi.c
parentd36421d3769c964e6edfb700f03ef48cbe7af4e9 (diff)
parent16cfa78aa98da19f5928dd6bd036705096017815 (diff)
downloadzsh-9d2cfa7af6b8973e13716f7c36f7fb156e3348dd.tar.gz
zsh-9d2cfa7af6b8973e13716f7c36f7fb156e3348dd.tar.xz
zsh-9d2cfa7af6b8973e13716f7c36f7fb156e3348dd.zip
Merge branch 'master' of git://git.code.sf.net/p/zsh/code
Conflicts:
	ChangeLog
Diffstat (limited to 'Src/Zle/zle_vi.c')
-rw-r--r--Src/Zle/zle_vi.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/Src/Zle/zle_vi.c b/Src/Zle/zle_vi.c
index 53919e361..0a8b27d65 100644
--- a/Src/Zle/zle_vi.c
+++ b/Src/Zle/zle_vi.c
@@ -248,6 +248,7 @@ getvirange(int wf)
      * point we just need to make the range encompass entire lines.   */
     if(vilinerange) {
 	int newcs = findbol();
+	lastcol = zlecs - newcs;
 	zlecs = pos;
 	pos = findeol();
 	zlecs = newcs;
@@ -348,6 +349,7 @@ videlete(UNUSED(char **args))
 	forekill(c2 - zlecs, CUT_RAW);
 	ret = 0;
 	if (vilinerange && zlell) {
+	    lastcol = -1;
 	    if (zlecs == zlell)
 		DECCS();
 	    foredel(1, 0);
@@ -449,7 +451,7 @@ vichangewholeline(char **args)
 int
 viyank(UNUSED(char **args))
 {
-    int oldcs = zlecs, c2, ret = 1;
+    int c2, ret = 1;
 
     startvichange(1);
     if ((c2 = getvirange(0)) != -1) {
@@ -459,11 +461,19 @@ viyank(UNUSED(char **args))
     vichgflag = 0;
     /* cursor now at the start of the range yanked. For line mode
      * restore the column position */
-    if (vilinerange) {
-	while (oldcs > 0 && zleline[oldcs - 1] != ZWC('\n') &&
-		zlecs != zlell && zleline[zlecs] != ZWC('\n')) {
-	    ++zlecs; --oldcs;
+    if (vilinerange && lastcol != -1) {
+	int x = findeol();
+
+	if ((zlecs += lastcol) >= x) {
+	    zlecs = x;
+	    if (zlecs > findbol() && invicmdmode())
+		DECCS();
 	}
+#ifdef MULTIBYTE_SUPPORT
+	else
+	    CCRIGHT();
+#endif
+	lastcol = -1;
     }
     return ret;
 }