summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: eb4967e)
raw | patch | inline | side by side (parent: eb4967e)
author | Max Kellermann <max@duempel.org> | |
Thu, 19 Nov 2009 20:05:17 +0000 (21:05 +0100) | ||
committer | Max Kellermann <max@duempel.org> | |
Thu, 19 Nov 2009 20:05:17 +0000 (21:05 +0100) |
src/charset.c | patch | blob | history |
diff --git a/src/charset.c b/src/charset.c
index 6282fbf35167cc7015dafd7822c486934809a0b2..440084406d2f5837d239a356da48b5f068294a9f 100644 (file)
--- a/src/charset.c
+++ b/src/charset.c
}
#endif
+#ifdef ENABLE_WIDE
+static inline unsigned
+unicode_char_width(gunichar ch)
+{
+ if (g_unichar_iswide(ch))
+ return 2;
+
+ return 1;
+}
+#endif /* ENABLE_WIDE */
+
unsigned
utf8_width(const char *str)
{
while (len--) {
c = g_utf8_get_char(str);
- width += g_unichar_iswide(c) ? 2 : 1;
+ width += unicode_char_width(c);
str += g_unichar_to_utf8(c, NULL);
}