diff options
| author | tylov <[email protected]> | 2023-08-17 09:54:16 +0200 |
|---|---|---|
| committer | tylov <[email protected]> | 2023-08-17 09:54:16 +0200 |
| commit | 311f12d7005351ca245aa1df77889d8db4899862 (patch) | |
| tree | 91d98717390df1394fb4dc0e3a354551e989aa9b /include/stc/csview.h | |
| parent | be0e64a9a19d3ca459284c61c497d141a78df1d7 (diff) | |
| download | STC-modified-311f12d7005351ca245aa1df77889d8db4899862.tar.gz STC-modified-311f12d7005351ca245aa1df77889d8db4899862.zip | |
Simplified access to utf8 character .chr in cstr / csview / crawstr iterators. Backward compatibility kept, but deprecated.
Diffstat (limited to 'include/stc/csview.h')
| -rw-r--r-- | include/stc/csview.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/include/stc/csview.h b/include/stc/csview.h index 5aba6926..a2d1e9f0 100644 --- a/include/stc/csview.h +++ b/include/stc/csview.h @@ -89,8 +89,8 @@ STC_INLINE csview_iter csview_end(const csview* self) { return c_LITERAL(csview_iter){.u8 = {{NULL}, self->buf + self->size}}; } STC_INLINE void csview_next(csview_iter* it) { - it->ref += it->u8.chr.size; - it->u8.chr.size = utf8_chr_size(it->ref); + it->ref += it->chr.size; + it->chr.size = utf8_chr_size(it->ref); if (it->ref == it->u8.end) it->ref = NULL; } @@ -159,7 +159,7 @@ STC_DEF csview_iter csview_advance(csview_iter it, intptr_t pos) { int inc = -1; if (pos > 0) pos = -pos, inc = 1; while (pos && it.ref != it.u8.end) pos += (*(it.ref += inc) & 0xC0) != 0x80; - it.u8.chr.size = utf8_chr_size(it.ref); + it.chr.size = utf8_chr_size(it.ref); if (it.ref == it.u8.end) it.ref = NULL; return it; } |
