summaryrefslogtreecommitdiff
path: root/Src/Zle/zle_vi.c
diff options
context:
space:
mode:
authorOliver Kiddle <opk@zsh.org>2014-10-24 00:18:32 +0200
committerOliver Kiddle <opk@zsh.org>2014-10-24 00:18:32 +0200
commit746b53d5d7792ebb63b638116973f32fc492787a (patch)
treeec8c92f4e8c7e14e36f29157c454377602314469 /Src/Zle/zle_vi.c
parentbd6f119942bae2c3e914cabbb69624884ab1bc79 (diff)
downloadzsh-746b53d5d7792ebb63b638116973f32fc492787a.tar.gz
zsh-746b53d5d7792ebb63b638116973f32fc492787a.zip
33520: correct cursor positioning following a vi mode yank operation
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;
}