version 1.8, 2012/07/10 11:53:01 |
version 1.9, 2012/07/11 07:10:15 |
|
|
* Enter choice mode to choose a buffer. |
* Enter choice mode to choose a buffer. |
*/ |
*/ |
|
|
int cmd_choose_buffer_exec(struct cmd *, struct cmd_ctx *); |
enum cmd_retval cmd_choose_buffer_exec(struct cmd *, struct cmd_ctx *); |
|
|
void cmd_choose_buffer_callback(struct window_choose_data *); |
void cmd_choose_buffer_callback(struct window_choose_data *); |
void cmd_choose_buffer_free(struct window_choose_data *); |
void cmd_choose_buffer_free(struct window_choose_data *); |
|
|
cmd_choose_buffer_exec |
cmd_choose_buffer_exec |
}; |
}; |
|
|
int |
enum cmd_retval |
cmd_choose_buffer_exec(struct cmd *self, struct cmd_ctx *ctx) |
cmd_choose_buffer_exec(struct cmd *self, struct cmd_ctx *ctx) |
{ |
{ |
struct args *args = self->args; |
struct args *args = self->args; |
|
|
|
|
if (ctx->curclient == NULL) { |
if (ctx->curclient == NULL) { |
ctx->error(ctx, "must be run interactively"); |
ctx->error(ctx, "must be run interactively"); |
return (-1); |
return (CMD_RETURN_ERROR); |
} |
} |
|
|
if ((template = args_get(args, 'F')) == NULL) |
if ((template = args_get(args, 'F')) == NULL) |
template = DEFAULT_BUFFER_LIST_TEMPLATE; |
template = DEFAULT_BUFFER_LIST_TEMPLATE; |
|
|
if ((wl = cmd_find_window(ctx, args_get(args, 't'), NULL)) == NULL) |
if ((wl = cmd_find_window(ctx, args_get(args, 't'), NULL)) == NULL) |
return (-1); |
return (CMD_RETURN_ERROR); |
|
|
if (paste_get_top(&global_buffers) == NULL) |
if (paste_get_top(&global_buffers) == NULL) |
return (0); |
return (CMD_RETURN_NORMAL); |
|
|
if (window_pane_set_mode(wl->window->active, &window_choose_mode) != 0) |
if (window_pane_set_mode(wl->window->active, &window_choose_mode) != 0) |
return (0); |
return (CMD_RETURN_NORMAL); |
|
|
if (args->argc != 0) |
if (args->argc != 0) |
action = xstrdup(args->argv[0]); |
action = xstrdup(args->argv[0]); |
|
|
window_choose_ready(wl->window->active, |
window_choose_ready(wl->window->active, |
0, cmd_choose_buffer_callback, cmd_choose_buffer_free); |
0, cmd_choose_buffer_callback, cmd_choose_buffer_free); |
|
|
return (0); |
return (CMD_RETURN_NORMAL); |
} |
} |
|
|
void |
void |