--- This is the quick-and-dirty way to implement a feature I miss from Vim. I realize that I added some newlines for readability (subjective, I know) but I can send a new version of the patch without those if you don't want them. vis.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/vis.c b/vis.c index f630e7f..490ebc0 100644 --- a/vis.c +++ b/vis.c _AT_@ -486,6 +486,8 @@ static size_t op_yank(OperatorContext *c) { static size_t op_put(OperatorContext *c) { Text *txt = vis->win->file->text; size_t pos = c->pos; + size_t origpos = pos; + if (c->arg->i > 0) { if (c->reg->linewise) pos = text_line_next(txt, pos); _AT_@ -495,11 +497,16 @@ static size_t op_put(OperatorContext *c) { if (c->reg->linewise) pos = text_line_begin(txt, pos); } - text_insert(txt, pos, c->reg->data, c->reg->len); + + int times = (c->count == 0) ? 1 : c->count; + for (int i = 0; i < times; i++) { + text_insert(txt, pos, c->reg->data, c->reg->len); + pos += c->reg->len; + } if (c->reg->linewise) - return text_line_start(txt, pos); + return text_line_start(txt, origpos); else - return pos + c->reg->len; + return origpos + c->reg->len; } static const char *expand_tab(void) { -- 2.4.6Received on Wed Jul 29 2015 - 20:52:07 CEST
This archive was generated by hypermail 2.3.0 : Wed Jul 29 2015 - 21:00:13 CEST