diff options
| author | Marc André Tanner <mat@brain-dump.org> | 2016-04-27 11:17:53 +0200 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2016-04-27 11:17:53 +0200 |
| commit | eb1e37f0732654d3d1965f1487115e3c5d8a3f59 (patch) | |
| tree | 235146c0ace777efd69bd89c4aef856f4bb6d780 | |
| parent | c18f3b380da365ee9f8503d6f237d23218b84c77 (diff) | |
| download | vis-eb1e37f0732654d3d1965f1487115e3c5d8a3f59.tar.gz vis-eb1e37f0732654d3d1965f1487115e3c5d8a3f59.tar.xz | |
vis: adapt charwise put operator to not move across lines
This should let `$p` work as before the changes to `$`.
| -rw-r--r-- | vis-operators.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/vis-operators.c b/vis-operators.c index aceb3d1..b2f3fc7 100644 --- a/vis-operators.c +++ b/vis-operators.c @@ -31,6 +31,7 @@ static size_t op_yank(Vis *vis, Text *txt, OperatorContext *c) { } static size_t op_put(Vis *vis, Text *txt, OperatorContext *c) { + char b; size_t pos = c->pos; bool sel = text_range_size(&c->range) > 0; bool sel_linewise = sel && text_range_is_linewise(txt, &c->range); @@ -43,7 +44,7 @@ static size_t op_put(Vis *vis, Text *txt, OperatorContext *c) { case VIS_OP_PUT_AFTER_END: if (c->reg->linewise && !sel_linewise) pos = text_line_next(txt, pos); - else if (!sel) + else if (!sel && text_byte_get(txt, pos, &b) && b != '\r' && b != '\n') pos = text_char_next(txt, pos); break; case VIS_OP_PUT_BEFORE: |
