diff options
| author | Marc André Tanner <mat@brain-dump.org> | 2017-02-01 18:00:38 +0100 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2017-02-01 18:00:38 +0100 |
| commit | fca4988f377df4b4e41134f30777ec57758c7009 (patch) | |
| tree | 97334e37f959ee678f0305b3fca9dc60d8d0c886 /vis-operators.c | |
| parent | 1b70211a26bcae1e26b17c8ed6b1d8f25e40d0a6 (diff) | |
| download | vis-fca4988f377df4b4e41134f30777ec57758c7009.tar.gz vis-fca4988f377df4b4e41134f30777ec57758c7009.tar.xz | |
vis: insert new line after linewise change commands
This should also (at least partially) address the issues raised
in #440 and #442.
Diffstat (limited to 'vis-operators.c')
| -rw-r--r-- | vis-operators.c | 5 |
1 files changed, 4 insertions, 1 deletions
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) { |
