Skip to content

Commit

Permalink
sam: fix + address
Browse files Browse the repository at this point in the history
Previoulsy + would not advance to the next line when the cursor was
on the first character of a line. This should fix the +- idiom, i.e.

 :+-x/foo/c/bar/

performs a substitution on the current line.
  • Loading branch information
martanne committed Jun 5, 2017
1 parent 7aad8b1 commit 081d99d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sam.c
Original file line number Diff line number Diff line change
Expand Up @@ -980,7 +980,7 @@ static Filerange address_line_evaluate(Address *addr, File *file, Filerange *ran
size_t start = range->start, end = range->end, line;
if (sign > 0) {
char c;
if (end > 0 && text_byte_get(txt, end-1, &c) && c == '\n')
if (start < end && end > 0 && text_byte_get(txt, end-1, &c) && c == '\n')
end--;
line = text_lineno_by_pos(txt, end);
line = text_pos_by_lineno(txt, line + offset);
Expand Down

0 comments on commit 081d99d

Please sign in to comment.