[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/src/w32menu.c,v
From: |
Jason Rumney |
Subject: |
[Emacs-diffs] Changes to emacs/src/w32menu.c,v |
Date: |
Sun, 17 Jun 2007 22:10:06 +0000 |
CVSROOT: /sources/emacs
Module name: emacs
Changes by: Jason Rumney <jasonr> 07/06/17 22:10:06
Index: w32menu.c
===================================================================
RCS file: /sources/emacs/emacs/src/w32menu.c,v
retrieving revision 1.89
retrieving revision 1.90
diff -u -b -r1.89 -r1.90
--- w32menu.c 16 Jun 2007 18:12:18 -0000 1.89
+++ w32menu.c 17 Jun 2007 22:10:06 -0000 1.90
@@ -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';
}