aboutsummaryrefslogtreecommitdiff
path: root/text-motions.c
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2014-08-28 15:04:43 +0200
committerMarc André Tanner <mat@brain-dump.org>2014-08-28 15:04:43 +0200
commitba8dedd3a813b3f4565bac985fe6793e8da27016 (patch)
tree5cd36b08115f32eae8a8c2d93bd3a41ef9fb3c53 /text-motions.c
parent8a33f6ab4edaf9e43388f99b75229aab1ee7ba23 (diff)
downloadvis-ba8dedd3a813b3f4565bac985fe6793e8da27016.tar.gz
vis-ba8dedd3a813b3f4565bac985fe6793e8da27016.tar.xz
motion: add character wise motion
Diffstat (limited to 'text-motions.c')
-rw-r--r--text-motions.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/text-motions.c b/text-motions.c
index 8154e2b..4dc094a 100644
--- a/text-motions.c
+++ b/text-motions.c
@@ -4,6 +4,18 @@
// TODO: consistent usage of iterators either char or byte based where appropriate.
+size_t text_char_next(Text *txt, size_t pos) {
+ Iterator it = text_iterator_get(txt, pos);
+ text_iterator_char_next(&it, NULL);
+ return it.pos;
+}
+
+size_t text_char_prev(Text *txt, size_t pos) {
+ Iterator it = text_iterator_get(txt, pos);
+ text_iterator_char_prev(&it, NULL);
+ return it.pos;
+}
+
size_t text_find_char_next(Text *txt, size_t pos, const char *s, size_t len) {
char c;
size_t matched = 0;