From 746b53d5d7792ebb63b638116973f32fc492787a Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Fri, 24 Oct 2014 00:18:32 +0200 Subject: 33520: correct cursor positioning following a vi mode yank operation --- Src/Zle/zle_vi.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'Src/Zle') 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; } -- cgit 1.4.1