diff options
| author | Marc André Tanner <mat@brain-dump.org> | 2015-11-23 11:10:38 +0100 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2015-11-23 11:39:37 +0100 |
| commit | 51e92f0c8e7b50c684287bea1a55edbde128053f (patch) | |
| tree | 02eaed9cd71db186569698928c7afeca457e2bd7 /text.h | |
| parent | 0667089d47dd0cee5bda83965ff6bbdc2e4fd288 (diff) | |
| download | vis-51e92f0c8e7b50c684287bea1a55edbde128053f.tar.gz vis-51e92f0c8e7b50c684287bea1a55edbde128053f.tar.xz | |
text: introduce functions to iterate over graphemes
They currently consider any character for which wcwidth(3)
return 0 as a combining character.
Diffstat (limited to 'text.h')
| -rw-r--r-- | text.h | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -84,7 +84,12 @@ bool text_iterator_byte_prev(Iterator*, char *b); /* if the new position is at EOF a NUL byte (which is not actually * part of the file) is read. */ bool text_iterator_byte_next(Iterator*, char *b); - +/* move to the next/previous UTF-8 encoded Unicode codepoint + * and set c (if it is non NULL) to the first byte */ +bool text_iterator_codepoint_next(Iterator *it, char *c); +bool text_iterator_codepoint_prev(Iterator *it, char *c); +/* move to next/previous grapheme i.e. might skip over multiple + * Unicode codepoints (e.g. for combining characters) */ bool text_iterator_char_next(Iterator*, char *c); bool text_iterator_char_prev(Iterator*, char *c); |
