summaryrefslogtreecommitdiff
path: root/unicode.h
diff options
context:
space:
mode:
authorLeo Tenenbaum <pommicket@gmail.com>2020-11-29 18:45:10 -0500
committerLeo Tenenbaum <pommicket@gmail.com>2020-11-29 18:45:10 -0500
commitc4fdc35b3b21faecda42e434b28e4fb6db39d3e6 (patch)
treecdaa3410f3c3b8303a959e0d1fe31a4a3f00ef6b /unicode.h
parent0826ab93914b508f9a37edf6bd4307bb0ecea14c (diff)
moving around the cursor
Diffstat (limited to 'unicode.h')
-rw-r--r--unicode.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/unicode.h b/unicode.h
index 387c08d..3f76090 100644
--- a/unicode.h
+++ b/unicode.h
@@ -2,4 +2,11 @@
#define UNICODE_H_
#define UNICODE_BOX_CHARACTER 0x2610
#define UNICODE_CODE_POINTS 0x110000 // number of Unicode code points
+
+static bool unicode_is_start_of_code_point(u8 byte) {
+ // see https://en.wikipedia.org/wiki/UTF-8#Encoding
+ // continuation bytes are of the form 10xxxxxx
+ return (byte & 0xC0) != 0x80;
+}
+
#endif