* keymap.c (Fdefine_key, Flookup_key):
* macros.c (Fstart_kbd_macro): Likewise. Avoid call to Flength.
+ * term.c (tty_menu_add_pane, tty_menu_add_selection):
+ Use menu_item_width.
+ (tty_menu_show): Simplify because ty_menu_create never return NULL.
+
2014-07-13 Paul Eggert <eggert@cs.ucla.edu>
Improve behavior of 'bzr up; cd src; make -k'.
tty_menu_add_pane (tty_menu *menu, const char *txt)
{
int len;
- const unsigned char *p;
tty_menu_make_room (menu);
menu->submenu[menu->count] = tty_menu_create ();
menu->count++;
/* Update the menu width, if necessary. */
- for (len = 0, p = (unsigned char *) txt; *p; )
- {
- int ch_len;
- int ch = STRING_CHAR_AND_LENGTH (p, ch_len);
-
- len += CHAR_WIDTH (ch);
- p += ch_len;
- }
-
+ len = menu_item_width ((const unsigned char *) txt);
if (len > menu->width)
menu->width = len;
char *txt, bool enable, char const *help_text)
{
int len;
- unsigned char *p;
if (pane)
{
menu->count++;
/* Update the menu width, if necessary. */
- for (len = 0, p = (unsigned char *) txt; *p; )
- {
- int ch_len;
- int ch = STRING_CHAR_AND_LENGTH (p, ch_len);
-
- len += CHAR_WIDTH (ch);
- p += ch_len;
- }
-
+ len = menu_item_width ((const unsigned char *) txt);
if (len > menu->width)
menu->width = len;
/* Make the menu on that window. */
menu = tty_menu_create ();
- if (menu == NULL)
- {
- *error_name = "Can't create menu";
- return Qnil;
- }
/* Don't GC while we prepare and show the menu, because we give the
menu functions pointers to the contents of strings. */