diff src/text.c @ 3571:f6cd5fe9bf4c

[xemacs-hg @ 2006-08-24 21:21:34 by aidan] Vary support for multiple-width characters on a per-console basis.
author aidan
date Thu, 24 Aug 2006 21:21:36 +0000
parents b03fc4eae965
children 1fe680cefdb7
line wrap: on
line diff
--- a/src/text.c	Wed Aug 23 21:51:03 2006 +0000
+++ b/src/text.c	Thu Aug 24 21:21:36 2006 +0000
@@ -1998,20 +1998,26 @@
 #endif
 }
 
+/* A couple of these functions should only be called on a non-Mule build. */
+#ifdef MULE
+#define ASSERT_BUILT_WITH_MULE() assert(1)
+#else /* MULE */
+#define ASSERT_BUILT_WITH_MULE() assert(0)
+#endif /* MULE */
+
 int
 ibyte_string_displayed_columns (const Ibyte *str, Bytecount len)
 {
   int cols = 0;
   const Ibyte *end = str + len;
+  Ichar ch;
+
+  ASSERT_BUILT_WITH_MULE();
 
   while (str < end)
     {
-#ifdef MULE
-      Ichar ch = itext_ichar (str);
+      ch = itext_ichar (str);
       cols += XCHARSET_COLUMNS (ichar_charset (ch));
-#else
-      cols++;
-#endif
       INC_IBYTEPTR (str);
     }
 
@@ -2019,19 +2025,17 @@
 }
 
 int
-ichar_string_displayed_columns (const Ichar *USED_IF_MULE (str), Charcount len)
+ichar_string_displayed_columns (const Ichar * USED_IF_MULE(str), Charcount len)
 {
-#ifdef MULE
   int cols = 0;
   int i;
 
+  ASSERT_BUILT_WITH_MULE();
+
   for (i = 0; i < len; i++)
     cols += XCHARSET_COLUMNS (ichar_charset (str[i]));
 
   return cols;
-#else  /* not MULE */
-  return len;
-#endif
 }
 
 Charcount