vis

a vi-like editor based on Plan 9's structural regular expressions

git clone https://9o.is/git/vis.git

commit 3e29fe659b3038ef264b03dfd30a580bf560ba3f
parent b63a67299361354961c8457219db9a026b1cdbcf
Author: Marc André Tanner <mat@brain-dump.org>
Date:   Wed,  1 Feb 2017 18:00:38 +0100

vis: insert new line after linewise change commands

This should also (at least partially) address the issues raised
in #440 and #442.

Diffstat:
Mvis-operators.c | 5++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git 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) {