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

Diff for /src/usr.bin/tmux/cmd-find.c between version 1.17 and 1.18

version 1.17, 2015/10/28 09:51:55 version 1.18, 2015/12/13 15:00:37
Line 76 
Line 76 
 int     cmd_find_get_pane_with_window(struct cmd_find_state *, const char *);  int     cmd_find_get_pane_with_window(struct cmd_find_state *, const char *);
   
 void    cmd_find_clear_state(struct cmd_find_state *, struct cmd_q *, int);  void    cmd_find_clear_state(struct cmd_find_state *, struct cmd_q *, int);
 void    cmd_find_log_state(const char *, const char *, struct cmd_find_state *);  void    cmd_find_log_state(const char *, struct cmd_find_state *);
   
 struct cmd_find_state   *cmd_find_target(struct cmd_q *, const char *,  struct cmd_find_state   *cmd_find_target(struct cmd_q *, const char *,
             enum cmd_find_type, int);              enum cmd_find_type, int);
Line 827 
Line 827 
         char                            *colon, *period, *copy = NULL;          char                            *colon, *period, *copy = NULL;
         const char                      *session, *window, *pane;          const char                      *session, *window, *pane;
   
           /* Log the arguments. */
           if (target == NULL)
                   log_debug("%s: target none, type %d", __func__, type);
           else
                   log_debug("%s: target %s, type %d", __func__, target, type);
           log_debug("%s: cmdq %p, flags %#x", __func__, cmdq, flags);
   
         /* Find current state. */          /* Find current state. */
         cmd_find_clear_state(&current, cmdq, flags);          cmd_find_clear_state(&current, cmdq, flags);
         if (server_check_marked() && (flags & CMD_FIND_DEFAULT_MARKED)) {          if (server_check_marked() && (flags & CMD_FIND_DEFAULT_MARKED)) {
Line 873 
Line 880 
                                 cmdq_error(cmdq, "no mouse target");                                  cmdq_error(cmdq, "no mouse target");
                         goto error;                          goto error;
                 }                  }
                 return (&fs);                  goto found;
         }          }
   
         /* Marked target is a plain ~ or {marked}. */          /* Marked target is a plain ~ or {marked}. */
Line 888 
Line 895 
                 fs.idx = fs.wl->idx;                  fs.idx = fs.wl->idx;
                 fs.w = fs.wl->window;                  fs.w = fs.wl->window;
                 fs.wp = marked_window_pane;                  fs.wp = marked_window_pane;
                 return (&fs);                  goto found;
         }          }
   
         /* Find separators if they exist. */          /* Find separators if they exist. */
Line 1053 
Line 1060 
         free(copy);          free(copy);
         if (flags & CMD_FIND_WINDOW_INDEX)          if (flags & CMD_FIND_WINDOW_INDEX)
                 current.idx = -1;                  current.idx = -1;
           cmd_find_log_state(__func__, &current);
         return (&current);          return (&current);
   
 error:  error:
         free(copy);          free(copy);
           log_debug("    error");
         return (NULL);          return (NULL);
   
 found:  found:
           cmd_find_log_state(__func__, &fs);
         free(copy);          free(copy);
         return (&fs);          return (&fs);
   
Line 1081 
Line 1091 
   
 /* Log the result. */  /* Log the result. */
 void  void
 cmd_find_log_state(const char *f, const char *target, struct cmd_find_state *fs)  cmd_find_log_state(const char *prefix, struct cmd_find_state *fs)
 {  {
         log_debug("%s: target %s%s", f, target == NULL ? "none" : target,  
             fs != NULL ? "" : " (failed)");  
         if (fs == NULL)  
                 return;  
         if (fs->s != NULL)          if (fs->s != NULL)
                 log_debug("\ts=$%u", fs->s->id);                  log_debug("%s: s=$%u", prefix, fs->s->id);
         else          else
                 log_debug("\ts=none");                  log_debug("%s: s=none", prefix);
         if (fs->wl != NULL) {          if (fs->wl != NULL) {
                 log_debug("\twl=%u %d w=@%u %s", fs->wl->idx,                  log_debug("%s: wl=%u %d w=@%u %s", prefix, fs->wl->idx,
                     fs->wl->window == fs->w, fs->w->id, fs->w->name);                      fs->wl->window == fs->w, fs->w->id, fs->w->name);
         } else          } else
                 log_debug("\twl=none");                  log_debug("%s: wl=none", prefix);
         if (fs->wp != NULL)          if (fs->wp != NULL)
                 log_debug("\twp=%%%u", fs->wp->id);                  log_debug("%s: wp=%%%u", prefix, fs->wp->id);
         else          else
                 log_debug("\twp=none");                  log_debug("%s: wp=none", prefix);
         if (fs->idx != -1)          if (fs->idx != -1)
                 log_debug("\tidx=%d", fs->idx);                  log_debug("%s: idx=%d", prefix, fs->idx);
         else          else
                 log_debug("\tidx=none");                  log_debug("%s: idx=none", prefix);
 }  }
   
 /* Find the current session. */  /* Find the current session. */
Line 1114 
Line 1120 
         int                      flags = CMD_FIND_QUIET;          int                      flags = CMD_FIND_QUIET;
   
         fs = cmd_find_target(cmdq, NULL, CMD_FIND_SESSION, flags);          fs = cmd_find_target(cmdq, NULL, CMD_FIND_SESSION, flags);
         cmd_find_log_state(__func__, NULL, fs);  
         if (fs == NULL)          if (fs == NULL)
                 return (NULL);                  return (NULL);
   
Line 1132 
Line 1137 
                 flags |= CMD_FIND_PREFER_UNATTACHED;                  flags |= CMD_FIND_PREFER_UNATTACHED;
   
         fs = cmd_find_target(cmdq, target, CMD_FIND_SESSION, flags);          fs = cmd_find_target(cmdq, target, CMD_FIND_SESSION, flags);
         cmd_find_log_state(__func__, target, fs);  
         if (fs == NULL)          if (fs == NULL)
                 return (NULL);                  return (NULL);
   
Line 1146 
Line 1150 
         struct cmd_find_state   *fs;          struct cmd_find_state   *fs;
   
         fs = cmd_find_target(cmdq, target, CMD_FIND_WINDOW, 0);          fs = cmd_find_target(cmdq, target, CMD_FIND_WINDOW, 0);
         cmd_find_log_state(__func__, target, fs);  
         if (fs == NULL)          if (fs == NULL)
                 return (NULL);                  return (NULL);
   
Line 1164 
Line 1167 
         int                      flags = CMD_FIND_DEFAULT_MARKED;          int                      flags = CMD_FIND_DEFAULT_MARKED;
   
         fs = cmd_find_target(cmdq, target, CMD_FIND_WINDOW, flags);          fs = cmd_find_target(cmdq, target, CMD_FIND_WINDOW, flags);
         cmd_find_log_state(__func__, target, fs);  
         if (fs == NULL)          if (fs == NULL)
                 return (NULL);                  return (NULL);
   
Line 1181 
Line 1183 
         struct cmd_find_state   *fs;          struct cmd_find_state   *fs;
   
         fs = cmd_find_target(cmdq, target, CMD_FIND_PANE, 0);          fs = cmd_find_target(cmdq, target, CMD_FIND_PANE, 0);
         cmd_find_log_state(__func__, target, fs);  
         if (fs == NULL)          if (fs == NULL)
                 return (NULL);                  return (NULL);
   
Line 1201 
Line 1202 
         int                      flags = CMD_FIND_DEFAULT_MARKED;          int                      flags = CMD_FIND_DEFAULT_MARKED;
   
         fs = cmd_find_target(cmdq, target, CMD_FIND_PANE, flags);          fs = cmd_find_target(cmdq, target, CMD_FIND_PANE, flags);
         cmd_find_log_state(__func__, target, fs);  
         if (fs == NULL)          if (fs == NULL)
                 return (NULL);                  return (NULL);
   
Line 1275 
Line 1275 
         int                      flags = CMD_FIND_WINDOW_INDEX;          int                      flags = CMD_FIND_WINDOW_INDEX;
   
         fs = cmd_find_target(cmdq, target, CMD_FIND_WINDOW, flags);          fs = cmd_find_target(cmdq, target, CMD_FIND_WINDOW, flags);
         cmd_find_log_state(__func__, target, fs);  
         if (fs == NULL)          if (fs == NULL)
                 return (-2);                  return (-2);
   

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