Skip to content

Commit

Permalink
vis: insert new line after linewise change commands
Browse files Browse the repository at this point in the history
This should also (at least partially) address the issues raised
in martanne#440 and martanne#442.
  • Loading branch information
martanne committed Feb 1, 2017
1 parent 1b70211 commit fca4988
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion vis-operators.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit fca4988

Please sign in to comment.