From eb1e37f0732654d3d1965f1487115e3c5d8a3f59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Wed, 27 Apr 2016 11:17:53 +0200 Subject: vis: adapt charwise put operator to not move across lines This should let `$p` work as before the changes to `$`. --- vis-operators.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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: -- cgit v1.2.3