Mercurial > hg > xemacs-beta
comparison src/menubar-msw.c @ 384:bbff43aa5eb7 r21-2-7
Import from CVS: tag r21-2-7
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:08:24 +0200 |
parents | 064ab7fed2e0 |
children | 6719134a07c2 |
comparison
equal
deleted
inserted
replaced
383:6a50c6a581a5 | 384:bbff43aa5eb7 |
---|---|
128 /* We construct the name in a static buffer. That's fine, because | 128 /* We construct the name in a static buffer. That's fine, because |
129 menu items longer than 128 chars are probably programming errors, | 129 menu items longer than 128 chars are probably programming errors, |
130 and better be caught than displayed! */ | 130 and better be caught than displayed! */ |
131 | 131 |
132 static char buf[MAX_MENUITEM_LENGTH+2]; | 132 static char buf[MAX_MENUITEM_LENGTH+2]; |
133 char *ptr; | |
133 unsigned int ll, lr; | 134 unsigned int ll, lr; |
134 | 135 |
135 /* Left flush part of the string */ | 136 /* Left flush part of the string */ |
136 ll = gui_item_display_flush_left (pgui_item, buf, MAX_MENUITEM_LENGTH); | 137 ll = gui_item_display_flush_left (pgui_item, buf, MAX_MENUITEM_LENGTH); |
138 | |
139 /* Escape '&' as '&&' */ | |
140 ptr = buf; | |
141 while ((ptr=memchr (ptr, '&', ll-(ptr-buf))) != NULL) | |
142 { | |
143 if (ll+2 >= MAX_MENUITEM_LENGTH) | |
144 signal_simple_error ("Menu item produces too long displayable string", | |
145 pgui_item->name); | |
146 memmove (ptr+1, ptr, ll-(ptr-buf)); | |
147 ll++; | |
148 ptr+=2; | |
149 } | |
150 | |
151 /* Replace XEmacs accelerator '%_' with Windows accelerator '&' */ | |
152 ptr = buf; | |
153 while ((ptr=memchr (ptr, '%', ll-(ptr-buf))) != NULL) | |
154 { | |
155 if (*(ptr+1) == '_') | |
156 { | |
157 *ptr = '&'; | |
158 memmove (ptr+1, ptr+2, ll-(ptr-buf+2)); | |
159 ll--; | |
160 } | |
161 ptr++; | |
162 } | |
137 | 163 |
138 /* Right flush part, unless we're at the top-level where it's not allowed */ | 164 /* Right flush part, unless we're at the top-level where it's not allowed */ |
139 if (!bar_p) | 165 if (!bar_p) |
140 { | 166 { |
141 assert (MAX_MENUITEM_LENGTH > ll + 1); | 167 assert (MAX_MENUITEM_LENGTH > ll + 1); |