vis

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

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

commit 9e3c8e4676d5cfb7a3d5d757d09ba8812aab58cf
parent 7ac3855b588fa78fadd02a92f9b35faec6101014
Author: Marc André Tanner <mat@brain-dump.org>
Date:   Wed, 27 Apr 2016 11:17:53 +0200

vis: adapt charwise put operator to not move across lines

This should let `$p` work as before the changes to `$`.

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

diff --git 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: