aboutsummaryrefslogtreecommitdiff
path: root/text-objects.c
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2014-09-17 14:03:14 +0200
committerMarc André Tanner <mat@brain-dump.org>2014-09-17 14:03:14 +0200
commit3469424ef143b125619de805eefb1480a4e2b227 (patch)
tree6aee41c7d86b11eb52d54695271934b17b466edf /text-objects.c
parente9a80294fd15d97de7fe6aa129d828ef280704a4 (diff)
downloadvis-3469424ef143b125619de805eefb1480a4e2b227.tar.gz
vis-3469424ef143b125619de805eefb1480a4e2b227.tar.xz
Simplify text_object_line implementation
Diffstat (limited to 'text-objects.c')
-rw-r--r--text-objects.c8
1 files changed, 1 insertions, 7 deletions
diff --git a/text-objects.c b/text-objects.c
index e1c53d3..142c01b 100644
--- 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;
}