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

Diff for /src/usr.bin/tmux/mode-tree.c between version 1.18 and 1.19

version 1.18, 2017/11/03 14:23:44 version 1.19, 2017/11/03 17:02:33
Line 190 
Line 190 
         }          }
 }  }
   
 static void  
 mode_tree_set_current(struct mode_tree_data *mtd, uint64_t tag)  
 {  
         u_int   i;  
   
         for (i = 0; i < mtd->line_size; i++) {  
                 if (mtd->line_list[i].item->tag == tag)  
                         break;  
         }  
         if (i != mtd->line_size) {  
                 mtd->current = i;  
                 if (mtd->current > mtd->height - 1)  
                         mtd->offset = mtd->current - mtd->height + 1;  
                 else  
                         mtd->offset = 0;  
         } else {  
                 mtd->current = 0;  
                 mtd->offset = 0;  
         }  
 }  
   
 void  void
 mode_tree_up(struct mode_tree_data *mtd, int wrap)  mode_tree_up(struct mode_tree_data *mtd, int wrap)
 {  {
Line 248 
Line 227 
         return (mtd->line_list[mtd->current].item->itemdata);          return (mtd->line_list[mtd->current].item->itemdata);
 }  }
   
   void
   mode_tree_expand_current(struct mode_tree_data *mtd)
   {
           if (!mtd->line_list[mtd->current].item->expanded) {
                   mtd->line_list[mtd->current].item->expanded = 1;
                   mode_tree_build(mtd);
           }
   }
   
   void
   mode_tree_set_current(struct mode_tree_data *mtd, uint64_t tag)
   {
           u_int   i;
   
           for (i = 0; i < mtd->line_size; i++) {
                   if (mtd->line_list[i].item->tag == tag)
                           break;
           }
           if (i != mtd->line_size) {
                   mtd->current = i;
                   if (mtd->current > mtd->height - 1)
                           mtd->offset = mtd->current - mtd->height + 1;
                   else
                           mtd->offset = 0;
           } else {
                   mtd->current = 0;
                   mtd->offset = 0;
           }
   }
   
 u_int  u_int
 mode_tree_count_tagged(struct mode_tree_data *mtd)  mode_tree_count_tagged(struct mode_tree_data *mtd)
 {  {
Line 718 
Line 727 
   
 int  int
 mode_tree_key(struct mode_tree_data *mtd, struct client *c, key_code *key,  mode_tree_key(struct mode_tree_data *mtd, struct client *c, key_code *key,
     struct mouse_event *m)      struct mouse_event *m, u_int *xp, u_int *yp)
 {  {
         struct mode_tree_line   *line;          struct mode_tree_line   *line;
         struct mode_tree_item   *current, *parent;          struct mode_tree_item   *current, *parent;
Line 731 
Line 740 
                         *key = KEYC_NONE;                          *key = KEYC_NONE;
                         return (0);                          return (0);
                 }                  }
                   if (xp != NULL)
                           *xp = x;
                   if (yp != NULL)
                           *yp = y;
                 if (x > mtd->width || y > mtd->height) {                  if (x > mtd->width || y > mtd->height) {
                         *key = KEYC_NONE;                          if (!mtd->preview || y < mtd->height)
                                   *key = KEYC_NONE;
                         return (0);                          return (0);
                 }                  }
                 if (mtd->offset + y < mtd->line_size) {                  if (mtd->offset + y < mtd->line_size) {

Legend:
Removed from v.1.18  
changed lines
  Added in v.1.19