emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] trunk r117529: * term.c (tty_menu_add_pane, tty_menu_add_s


From: Dmitry Antipov
Subject: [Emacs-diffs] trunk r117529: * term.c (tty_menu_add_pane, tty_menu_add_selection):
Date: Mon, 14 Jul 2014 15:07:21 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 117529
revision-id: address@hidden
parent: address@hidden
committer: Dmitry Antipov <address@hidden>
branch nick: trunk
timestamp: Mon 2014-07-14 19:06:52 +0400
message:
  * 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.
modified:
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/term.c                     term.c-20091113204419-o5vbwnq5f7feedwu-220
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2014-07-14 04:44:01 +0000
+++ b/src/ChangeLog     2014-07-14 15:06:52 +0000
@@ -7,6 +7,10 @@
        * 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  <address@hidden>
 
        Improve behavior of 'bzr up; cd src; make -k'.

=== modified file 'src/term.c'
--- a/src/term.c        2014-06-23 04:11:29 +0000
+++ b/src/term.c        2014-07-14 15:06:52 +0000
@@ -2942,7 +2942,6 @@
 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 ();
@@ -2952,15 +2951,7 @@
   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;
 
@@ -2974,7 +2965,6 @@
                        char *txt, bool enable, char const *help_text)
 {
   int len;
-  unsigned char *p;
 
   if (pane)
     {
@@ -2990,15 +2980,7 @@
   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;
 
@@ -3609,11 +3591,6 @@
 
   /* 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.  */


reply via email to

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