]> code.delx.au - gnu-emacs/commitdiff
(decode_mode_spec): Add parameter MULTIBYTE.
authorGerd Moellmann <gerd@gnu.org>
Wed, 19 Sep 2001 14:48:52 +0000 (14:48 +0000)
committerGerd Moellmann <gerd@gnu.org>
Wed, 19 Sep 2001 14:48:52 +0000 (14:48 +0000)
(display_mode_element): Display the string from decode_mode_spec
depending on its multibyteness.

src/ChangeLog
src/xdisp.c

index c55917d77be5f50ba02506a51c01ddc00db3e70a..ef2f0947d2158b6f8495b3c24f10dc42b549f3dd 100644 (file)
@@ -1,5 +1,9 @@
 2001-09-19  Gerd Moellmann  <gerd@gnu.org>
 
+       * xdisp.c (decode_mode_spec): Add parameter MULTIBYTE.
+       (display_mode_element): Display the string from decode_mode_spec
+       depending on its multibyteness.
+
        * s/netbsd.h (LD_SWITCH_SYSTEM, C_SWITCH_SYSTEM): Add /usr/pkg.
 
        * m/macppc.h (DATA_SEG_BITS): Also define for GCC 3.
index df8720ee0e8d0da05106704dc8edf255bb73878b..7ffa35b67a7e295d44ae4ffa77f137d312630439 100644 (file)
@@ -732,7 +732,7 @@ static int display_line P_ ((struct it *));
 static int display_mode_lines P_ ((struct window *));
 static int display_mode_line P_ ((struct window *, enum face_id, Lisp_Object));
 static int display_mode_element P_ ((struct it *, int, int, int, Lisp_Object));
-static char *decode_mode_spec P_ ((struct window *, int, int, int));
+static char *decode_mode_spec P_ ((struct window *, int, int, int, int *));
 static void display_menu_bar P_ ((struct window *));
 static int display_count_lines P_ ((int, int, int, int, int *));
 static int display_string P_ ((unsigned char *, Lisp_Object, Lisp_Object,
@@ -13449,22 +13449,25 @@ display_mode_element (it, depth, field_width, precision, elt)
                                             Vglobal_mode_string);
                else if (c != 0)
                  {
+                   int multibyte;
                    unsigned char *spec
-                     = decode_mode_spec (it->w, c, field, prec);
-                   
+                     = decode_mode_spec (it->w, c, field, prec, &multibyte);
+
                    if (frame_title_ptr)
                      n += store_frame_title (spec, field, prec);
                    else
                      {
-                       int nglyphs_before
-                         = it->glyph_row->used[TEXT_AREA];
-                       int bytepos
-                         = percent_position - XSTRING (elt)->data;
-                       int charpos
-                         = string_byte_to_char (elt, bytepos);
-                       int nwritten
-                         = display_string (spec, Qnil, elt, charpos, 0, it,
-                                           field, prec, 0, -1);
+                       int nglyphs_before, bytepos, charpos, nwritten;
+                       
+                       nglyphs_before = it->glyph_row->used[TEXT_AREA];
+                       bytepos = percent_position - XSTRING (elt)->data;
+                       charpos = (multibyte
+                                  ? string_byte_to_char (elt, bytepos)
+                                  : bytepos);
+                       nwritten = display_string (spec, Qnil, elt,
+                                                  charpos, 0, it,
+                                                  field, prec, 0,
+                                                  multibyte);
 
                        /* Assign to the glyphs written above the
                           string where the `%x' came from, position
@@ -13760,15 +13763,17 @@ decode_mode_spec_coding (coding_system, buf, eol_flag)
 /* Return a string for the output of a mode line %-spec for window W,
    generated by character C.  PRECISION >= 0 means don't return a
    string longer than that value.  FIELD_WIDTH > 0 means pad the
-   string returned with spaces to that value.  */
+   string returned with spaces to that value.  Return 1 in *MULTIBYTE
+   if the result is multibyte text.  */
 
 static char lots_of_dashes[] = "--------------------------------------------------------------------------------------------------------------------------------------------";
 
 static char *
-decode_mode_spec (w, c, field_width, precision)
+decode_mode_spec (w, c, field_width, precision, multibyte)
      struct window *w;
      register int c;
      int field_width, precision;
+     int *multibyte;
 {
   Lisp_Object obj;
   struct frame *f = XFRAME (WINDOW_FRAME (w));
@@ -13776,6 +13781,7 @@ decode_mode_spec (w, c, field_width, precision)
   struct buffer *b = XBUFFER (w->buffer);
 
   obj = Qnil;
+  *multibyte = 0;
 
   switch (c)
     {
@@ -14109,7 +14115,10 @@ decode_mode_spec (w, c, field_width, precision)
     }
 
   if (STRINGP (obj))
-    return (char *) XSTRING (obj)->data;
+    {
+      *multibyte = STRING_MULTIBYTE (obj);
+      return (char *) XSTRING (obj)->data;
+    }
   else
     return "";
 }