From 08ecde01710143fb93808f2e728a043aa77d9ad4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Sun, 21 Feb 2016 10:24:05 +0100 Subject: vis: insert missing new line when putting at the end of file Something like ifooyyp should produce foo foo not foofoo as was the case before. --- vis-operators.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'vis-operators.c') diff --git a/vis-operators.c b/vis-operators.c index 6e61d46..0f3ae19 100644 --- a/vis-operators.c +++ b/vis-operators.c @@ -57,6 +57,9 @@ static size_t op_put(Vis *vis, Text *txt, OperatorContext *c) { const char *data = register_get(vis, c->reg, &len); for (int i = 0; i < c->count; i++) { + char nl; + if (c->reg->linewise && pos > 0 && text_byte_get(txt, pos-1, &nl) && nl != '\n') + pos += text_insert_newline(txt, pos); text_insert(txt, pos, data, len); pos += len; } -- cgit v1.2.3