Skip to content

Commit

Permalink
vis: adapt charwise put operator to not move across lines
Browse files Browse the repository at this point in the history
This should let `$p` work as before the changes to `$`.
  • Loading branch information
martanne committed Apr 27, 2016
1 parent c18f3b3 commit eb1e37f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion vis-operators.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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:
Expand Down

0 comments on commit eb1e37f

Please sign in to comment.