vis

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

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

commit f6afcc32612e2eb4d555f9f4058aee5175738547
parent 90d51c28ac7a90aca7db21b40f87c39dbdc74ded
Author: Marc André Tanner <mat@brain-dump.org>
Date:   Wed, 17 Sep 2014 14:03:14 +0200

Simplify text_object_line implementation

Diffstat:
Mtext-objects.c | 8+-------
1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/text-objects.c b/text-objects.c @@ -52,15 +52,9 @@ Filerange text_object_word(Text *txt, size_t pos) { } Filerange text_object_line(Text *txt, size_t pos) { - char c; Filerange r; r.start = text_line_begin(txt, pos); - Iterator it = text_iterator_get(txt, text_line_end(txt, pos)); - if (text_iterator_byte_get(&it, &c) && c == '\n') - text_iterator_byte_next(&it, NULL); - if (text_iterator_byte_get(&it, &c) && c == '\r') - text_iterator_byte_next(&it, NULL); - r.end = it.pos; + r.end = text_line_next(txt, pos); return r; }