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

Diff for /src/usr.bin/tmux/cmd.c between version 1.35 and 1.36

version 1.35, 2009/12/03 22:50:10 version 1.36, 2009/12/08 07:49:31
Line 856 
Line 856 
 cmd_find_pane(struct cmd_ctx *ctx,  cmd_find_pane(struct cmd_ctx *ctx,
     const char *arg, struct session **sp, struct window_pane **wpp)      const char *arg, struct session **sp, struct window_pane **wpp)
 {  {
         struct session  *s;          struct session          *s;
         struct winlink  *wl;          struct winlink          *wl;
         const char      *period;          struct layout_cell      *lc;
         char            *winptr, *paneptr;          const char              *period, *errstr;
         const char      *errstr;          char                    *winptr, *paneptr;
         u_int            idx;          u_int                    idx;
   
         /* Get the current session. */          /* Get the current session. */
         if ((s = cmd_current_session(ctx)) == NULL) {          if ((s = cmd_current_session(ctx)) == NULL) {
Line 895 
Line 895 
                 *wpp = wl->window->active;                  *wpp = wl->window->active;
         else {          else {
                 idx = strtonum(paneptr, 0, INT_MAX, &errstr);                  idx = strtonum(paneptr, 0, INT_MAX, &errstr);
                 if (errstr != NULL) {                  if (errstr != NULL)
                         ctx->error(ctx, "pane %s: %s", errstr, paneptr);                          goto lookup_string;
                         goto error;  
                 }  
                 *wpp = window_pane_at_index(wl->window, idx);                  *wpp = window_pane_at_index(wl->window, idx);
                 if (*wpp == NULL) {                  if (*wpp == NULL)
                         ctx->error(ctx, "no such pane: %u", idx);                          goto lookup_string;
                         goto error;  
                 }  
         }          }
   
         xfree(winptr);          xfree(winptr);
         return (wl);          return (wl);
   
   lookup_string:
           /* Try pane string description. */
           if ((lc = layout_find_string(s->curw->window, paneptr)) == NULL) {
                   ctx->error(ctx, "can't find pane: %s", paneptr);
                   goto error;
           }
           *wpp = lc->wp;
   
           xfree(winptr);
           return (s->curw);
   
 no_period:  no_period:
         /* Try as a pane number alone. */          /* Try as a pane number alone. */
         idx = strtonum(arg, 0, INT_MAX, &errstr);          idx = strtonum(arg, 0, INT_MAX, &errstr);
Line 922 
Line 929 
         return (s->curw);          return (s->curw);
   
 lookup_window:  lookup_window:
           /* Try pane string description. */
           if ((lc = layout_find_string(s->curw->window, arg)) != NULL) {
                   *wpp = lc->wp;
                   return (s->curw);
           }
   
         /* Try as a window and use the active pane. */          /* Try as a window and use the active pane. */
         if ((wl = cmd_find_window(ctx, arg, sp)) != NULL)          if ((wl = cmd_find_window(ctx, arg, sp)) != NULL)
                 *wpp = wl->window->active;                  *wpp = wl->window->active;

Legend:
Removed from v.1.35  
changed lines
  Added in v.1.36