aboutsummaryrefslogtreecommitdiff
path: root/text-objects.c
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2015-08-01 13:20:40 +0200
committerMarc André Tanner <mat@brain-dump.org>2015-08-01 13:20:40 +0200
commit25beaeb21f3d0b2fcd9b6c612cd2d7cb25291a28 (patch)
treea864a4c03a7e37814ae46ff8de24fc956eb4c5b4 /text-objects.c
parent99753fa1f144b6e33c06b5a9a93725125b5e085a (diff)
downloadvis-25beaeb21f3d0b2fcd9b6c612cd2d7cb25291a28.tar.gz
vis-25beaeb21f3d0b2fcd9b6c612cd2d7cb25291a28.tar.xz
vis: support `ae` and `ie` text objects
Diffstat (limited to 'text-objects.c')
-rw-r--r--text-objects.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/text-objects.c b/text-objects.c
index 0d22ca4..0308e8c 100644
--- a/text-objects.c
+++ b/text-objects.c
@@ -22,6 +22,23 @@
#define isboundry is_word_boundry
+Filerange text_object_entire(Text *txt, size_t pos) {
+ return text_range_new(0, text_size(txt));
+}
+
+Filerange text_object_entire_inner(Text *txt, size_t pos) {
+ char c;
+ Filerange r = text_object_entire(txt, pos);
+ Iterator it = text_iterator_get(txt, r.start);
+ while (text_iterator_byte_get(&it, &c) && (c == '\r' || c == '\n'))
+ text_iterator_byte_next(&it, NULL);
+ r.start = it.pos;
+ it = text_iterator_get(txt, r.end);
+ while (text_iterator_byte_prev(&it, &c) && (c == '\r' || c == '\n'));
+ r.end = it.pos;
+ return text_range_linewise(txt, &r);
+}
+
/* TODO: reduce code duplication? */
Filerange text_object_longword(Text *txt, size_t pos) {