From fca4988f377df4b4e41134f30777ec57758c7009 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Wed, 1 Feb 2017 18:00:38 +0100 Subject: vis: insert new line after linewise change commands This should also (at least partially) address the issues raised in #440 and #442. --- vis-operators.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/vis-operators.c b/vis-operators.c index 6f3f0d1..2a51b2f 100644 --- a/vis-operators.c +++ b/vis-operators.c @@ -18,7 +18,10 @@ static size_t op_delete(Vis *vis, Text *txt, OperatorContext *c) { static size_t op_change(Vis *vis, Text *txt, OperatorContext *c) { op_delete(vis, txt, c); - return c->range.start; + size_t pos = c->range.start; + if (c->linewise) + pos = vis_text_insert_nl(vis, txt, pos > 0 ? pos-1 : pos); + return pos; } static size_t op_yank(Vis *vis, Text *txt, OperatorContext *c) { -- cgit v1.2.3