diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2016-09-22 20:36:26 +0100 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2016-10-01 13:45:00 +0100 |
| commit | 35559b65ddf107fea2a4dda92fcbd664986976d9 (patch) | |
| tree | 58840b2523abb01459afb09ad2480df07b9ddd2d /src/unicode.hh | |
| parent | 6e17ecfb6eadc157cc5229f3c36f2962cfe1fcdf (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.hh | 5 |
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, |
