diff options
| author | Marc André Tanner <mat@brain-dump.org> | 2017-04-04 09:22:26 +0200 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2017-04-04 09:31:49 +0200 |
| commit | ca0b1fe1a590aa640fb20fcdfde3aeed3a0eac03 (patch) | |
| tree | 3ed66754cf50cc2c38a93179f61e397f67778bb1 /text-motions.c | |
| parent | dd730eb1feb46e9688350b0ff401694653f90554 (diff) | |
| download | vis-ca0b1fe1a590aa640fb20fcdfde3aeed3a0eac03.tar.gz vis-ca0b1fe1a590aa640fb20fcdfde3aeed3a0eac03.tar.xz | |
vis: add motions to move by codepoints
Some people might prefer this for <Backspace> behavior. Except for that
and debugging purposes using `ga` and `g8` it is not yet that useful.
Diffstat (limited to 'text-motions.c')
| -rw-r--r-- | text-motions.c | 12 |
1 files changed, 12 insertions, 0 deletions
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; |
