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-motions.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-motions.h')
| -rw-r--r-- | text-motions.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/text-motions.h b/text-motions.h index d65bdf2..57aa09e 100644 --- a/text-motions.h +++ b/text-motions.h @@ -12,7 +12,7 @@ size_t text_begin(Text*, size_t pos); size_t text_end(Text*, size_t pos); -/* move to start of next / previous UTF-8 character */ +/* char refers to a grapheme (might skip over multiple Unicode codepoints) */ size_t text_char_next(Text*, size_t pos); size_t text_char_prev(Text*, size_t pos); @@ -39,11 +39,11 @@ size_t text_line_lastchar(Text*, size_t pos); size_t text_line_end(Text*, size_t pos); size_t text_line_next(Text*, size_t pos); size_t text_line_offset(Text*, size_t pos, size_t off); -/* get character count of the line upto `pos' */ +/* get grapheme count of the line upto `pos' */ int text_line_char_get(Text*, size_t pos); -/* get position of the `count' character in the line containing `pos' */ +/* get position of the `count' grapheme in the line containing `pos' */ size_t text_line_char_set(Text*, size_t pos, int count); -/* move to the next/previous character on the same line */ +/* move to the next/previous grapheme on the same line */ size_t text_line_char_next(Text*, size_t pos); size_t text_line_char_prev(Text*, size_t pos); /* move to the next/previous empty line */ |
