From ca0b1fe1a590aa640fb20fcdfde3aeed3a0eac03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Tue, 4 Apr 2017 09:22:26 +0200 Subject: vis: add motions to move by codepoints Some people might prefer this for behavior. Except for that and debugging purposes using `ga` and `g8` it is not yet that useful. --- text-motions.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'text-motions.c') diff --git a/text-motions.c b/text-motions.c index ee8220e..210e1f4 100644 --- a/text-motions.c +++ b/text-motions.c @@ -39,6 +39,18 @@ size_t text_char_prev(Text *txt, size_t pos) { return it.pos; } +size_t text_codepoint_next(Text *txt, size_t pos) { + Iterator it = text_iterator_get(txt, pos); + text_iterator_codepoint_next(&it, NULL); + return it.pos; +} + +size_t text_codepoint_prev(Text *txt, size_t pos) { + Iterator it = text_iterator_get(txt, pos); + text_iterator_codepoint_prev(&it, NULL); + return it.pos; +} + static size_t find_next(Text *txt, size_t pos, const char *s, bool line) { if (!s) return pos; -- cgit v1.2.3