version 1.54, 2011/05/08 20:35:58 |
version 1.55, 2011/06/05 10:53:05 |
|
|
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; |
struct layout_cell *lc; |
const char *period, *errstr; |
const char *period, *errstr; |
char *winptr, *paneptr; |
char *winptr, *paneptr; |
u_int idx; |
u_int idx; |
|
|
|
/* Get the current session. */ |
/* Get the current session. */ |
if ((s = cmd_current_session(ctx, 0)) == NULL) { |
if ((s = cmd_current_session(ctx, 0)) == NULL) { |
|
|
|
|
lookup_string: |
lookup_string: |
/* Try pane string description. */ |
/* Try pane string description. */ |
if ((lc = layout_find_string(wl->window, paneptr)) == NULL) { |
if ((*wpp = window_find_string(wl->window, paneptr)) == NULL) { |
ctx->error(ctx, "can't find pane: %s", paneptr); |
ctx->error(ctx, "can't find pane: %s", paneptr); |
goto error; |
goto error; |
} |
} |
*wpp = lc->wp; |
|
|
|
xfree(winptr); |
xfree(winptr); |
return (wl); |
return (wl); |
|
|
|
|
lookup_window: |
lookup_window: |
/* Try pane string description. */ |
/* Try pane string description. */ |
if ((lc = layout_find_string(s->curw->window, arg)) != NULL) { |
if ((*wpp = window_find_string(s->curw->window, arg)) != NULL) |
*wpp = lc->wp; |
|
return (s->curw); |
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) |