[BACK]Return to menu.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / tmux

Diff for /src/usr.bin/tmux/menu.c between version 1.8 and 1.9

version 1.8, 2019/05/28 07:18:42 version 1.9, 2019/05/28 09:50:54
Line 80 
Line 80 
                 menu->count--;                  menu->count--;
                 return;                  return;
         }          }
         if (item->key != KEYC_UNKNOWN && item->key != KEYC_NONE) {          if (*s != '-' && item->key != KEYC_UNKNOWN && item->key != KEYC_NONE) {
                 key = key_string_lookup_key(item->key);                  key = key_string_lookup_key(item->key);
                 xasprintf(&name, "%s#[default] #[align=right](%s)", s, key);                  xasprintf(&name, "%s#[default] #[align=right](%s)", s, key);
         } else          } else
Line 182 
Line 182 
         const struct menu_item          *item;          const struct menu_item          *item;
         struct cmdq_item                *new_item;          struct cmdq_item                *new_item;
         struct cmd_parse_result         *pr;          struct cmd_parse_result         *pr;
           const char                      *name;
   
         if (KEYC_IS_MOUSE(event->key)) {          if (KEYC_IS_MOUSE(event->key)) {
                 if (md->flags & MENU_NOMOUSE)                  if (md->flags & MENU_NOMOUSE)
Line 207 
Line 208 
         }          }
         switch (event->key) {          switch (event->key) {
         case KEYC_UP:          case KEYC_UP:
                   if (old == -1)
                           old = 0;
                 do {                  do {
                         if (md->choice == -1 || md->choice == 0)                          if (md->choice == -1 || md->choice == 0)
                                 md->choice = count - 1;                                  md->choice = count - 1;
                         else                          else
                                 md->choice--;                                  md->choice--;
                 } while (menu->items[md->choice].name == NULL);                          name = menu->items[md->choice].name;
                   } while ((name == NULL || *name == '-') && md->choice != old);
                 c->flags |= CLIENT_REDRAWOVERLAY;                  c->flags |= CLIENT_REDRAWOVERLAY;
                 return (0);                  return (0);
         case KEYC_DOWN:          case KEYC_DOWN:
                   if (old == -1)
                           old = 0;
                 do {                  do {
                         if (md->choice == -1 || md->choice == count - 1)                          if (md->choice == -1 || md->choice == count - 1)
                                 md->choice = 0;                                  md->choice = 0;
                 else                          else
                         md->choice++;                                  md->choice++;
                 } while (menu->items[md->choice].name == NULL);                          name = menu->items[md->choice].name;
                   } while ((name == NULL || *name == '-') && md->choice != old);
                 c->flags |= CLIENT_REDRAWOVERLAY;                  c->flags |= CLIENT_REDRAWOVERLAY;
                 return (0);                  return (0);
         case '\r':          case '\r':
Line 233 
Line 240 
                 return (1);                  return (1);
         }          }
         for (i = 0; i < (u_int)count; i++) {          for (i = 0; i < (u_int)count; i++) {
                   name = menu->items[i].name;
                   if (name == NULL || *name == '-')
                           continue;
                 if (event->key == menu->items[i].key) {                  if (event->key == menu->items[i].key) {
                         md->choice = i;                          md->choice = i;
                         goto chosen;                          goto chosen;
Line 244 
Line 254 
         if (md->choice == -1)          if (md->choice == -1)
                 return (1);                  return (1);
         item = &menu->items[md->choice];          item = &menu->items[md->choice];
         if (item->name == NULL)          if (item->name == NULL || *item->name == '-')
                 return (1);                  return (1);
         if (md->cb != NULL) {          if (md->cb != NULL) {
             md->cb(md->menu, md->choice, item->key, md->data);              md->cb(md->menu, md->choice, item->key, md->data);

Legend:
Removed from v.1.8  
changed lines
  Added in v.1.9