tvi: cursor position after put command - neatvi - [fork] simple vi-type editor … | |
git clone git://src.adamsgaard.dk/neatvi | |
Log | |
Files | |
Refs | |
README | |
--- | |
commit 09cb6ffbd817e3ad3b6755e3a59e7841ac2f009c | |
parent d1f4855224db5c5e09d987e742cd43bace5139ba | |
Author: Ali Gholami Rudi <[email protected]> | |
Date: Sat, 16 May 2015 09:10:39 +0430 | |
vi: cursor position after put command | |
Diffstat: | |
M vi.c | 6 +++++- | |
1 file changed, 5 insertions(+), 1 deletion(-) | |
--- | |
diff --git a/vi.c b/vi.c | |
t@@ -830,7 +830,7 @@ static int vc_put(int cmd) | |
sbuf_str(sb, s); | |
free(s); | |
} | |
- for (i = 0; i < MAX(cnt, 1); i++) | |
+ for (i = 0; i < cnt; i++) | |
sbuf_str(sb, buf); | |
if (ln) { | |
char *s = uc_sub(ln, off, -1); | |
t@@ -842,6 +842,10 @@ static int vc_put(int cmd) | |
if (ln) | |
lbuf_rm(xb, xrow, xrow + 1); | |
lbuf_put(xb, xrow, sbuf_buf(sb)); | |
+ if (ln) | |
+ xcol = ren_pos(lbuf_get(xb, xrow), off + uc_slen(buf) * cnt - … | |
+ else | |
+ lbuf_postindents(xb, &xrow, &xcol); | |
sbuf_free(sb); | |
return 0; | |
} |