vis

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

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

commit 419aca995dcb728f57503c94aaabf3f4b48207d4
parent fdf3a9a6a3e5f40cb3da160a3e2bde655e728037
Author: Marc André Tanner <mat@brain-dump.org>
Date:   Thu, 28 Aug 2014 15:04:43 +0200

motion: add character wise motion

Diffstat:
Mtext-motions.c | 12++++++++++++
Mtext-motions.h | 3+++
2 files changed, 15 insertions(+), 0 deletions(-)

diff --git 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; diff --git a/text-motions.h b/text-motions.h @@ -4,6 +4,9 @@ #include <stddef.h> #include "text.h" +size_t text_char_next(Text*, size_t pos); +size_t text_char_prev(Text*, size_t pos); + size_t text_find_char_next(Text*, size_t pos, const char *s, size_t len); size_t text_find_char_prev(Text*, size_t pos, const char *s, size_t len);