emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/src/w32menu.c,v [EMACS_22_BASE]


From: Jason Rumney
Subject: [Emacs-diffs] Changes to emacs/src/w32menu.c,v [EMACS_22_BASE]
Date: Sun, 17 Jun 2007 22:24:28 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Branch:         EMACS_22_BASE
Changes by:     Jason Rumney <jasonr>   07/06/17 22:24:27

Index: w32menu.c
===================================================================
RCS file: /sources/emacs/emacs/src/w32menu.c,v
retrieving revision 1.88.2.1
retrieving revision 1.88.2.2
diff -u -b -r1.88.2.1 -r1.88.2.2
--- w32menu.c   16 Jun 2007 18:18:30 -0000      1.88.2.1
+++ w32menu.c   17 Jun 2007 22:24:27 -0000      1.88.2.2
@@ -2291,11 +2291,26 @@
       /* Quote any special characters within the menu item's text and
         key binding.  */
       nlen = orig_len = strlen (out_string);
+      if (unicode_append_menu)
+        {
+          /* With UTF-8, & cannot be part of a multibyte character.  */
+          for (p = out_string; *p; p++)
+            {
+              if (*p == '&')
+                nlen++;
+            }
+        }
+      else
+        {
+          /* If encoded with the system codepage, use multibyte string
+             functions in case of multibyte characters that contain '&'.  */
       for (p = out_string; *p; p = _mbsinc (p))
        {
          if (_mbsnextc (p) == '&')
            nlen++;
        }
+        }
+
       if (nlen > orig_len)
        {
          p = out_string;
@@ -2303,6 +2318,14 @@
          q = out_string;
          while (*p)
            {
+              if (unicode_append_menu)
+                {
+                  if (*p == '&')
+                    *q++ = *p;
+                  *q++ = *p++;
+                }
+              else
+                {
              if (_mbsnextc (p) == '&')
                {
                  _mbsncpy (q, p, 1);
@@ -2312,6 +2335,7 @@
              p = _mbsinc (p);
              q = _mbsinc (q);
            }
+            }
          *q = '\0';
        }
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]