about summary refs log tree commit diff
path: root/Src/Zle/zle_vi.c
diff options
context:
space:
mode:
Diffstat (limited to 'Src/Zle/zle_vi.c')
-rw-r--r--Src/Zle/zle_vi.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/Src/Zle/zle_vi.c b/Src/Zle/zle_vi.c
index 20cece0a8..53919e361 100644
--- a/Src/Zle/zle_vi.c
+++ b/Src/Zle/zle_vi.c
@@ -457,7 +457,14 @@ viyank(UNUSED(char **args))
 	ret = 0;
     }
     vichgflag = 0;
-    zlecs = oldcs;
+    /* 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;
+	}
+    }
     return ret;
 }