summaryrefslogtreecommitdiff
path: root/src/unicode.hh
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2016-09-22 20:36:26 +0100
committerMaxime Coste <frrrwww@gmail.com>2016-10-01 13:45:00 +0100
commit35559b65ddf107fea2a4dda92fcbd664986976d9 (patch)
tree58840b2523abb01459afb09ad2480df07b9ddd2d /src/unicode.hh
parent6e17ecfb6eadc157cc5229f3c36f2962cfe1fcdf (diff)
Support codepoints of variable width
Add a ColumnCount type and use it in place of CharCount whenever more appropriate, take column size of codepoints into account for vertical movements and docstring wrapping. Fixes #811
Diffstat (limited to 'src/unicode.hh')
-rw-r--r--src/unicode.hh5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/unicode.hh b/src/unicode.hh
index 4ceeac74..12b75002 100644
--- a/src/unicode.hh
+++ b/src/unicode.hh
@@ -48,6 +48,11 @@ inline bool is_basic_alpha(Codepoint c)
return (c >= 'a' and c <= 'z') or (c >= 'A' and c <= 'Z');
}
+inline size_t get_width(Codepoint c)
+{
+ return wcwidth((wchar_t)c);
+}
+
enum class CharCategories
{
Blank,