Sync OpenBSD patchset 271:

Now that pane targets (-t) are supported, switch some commands to use them
where it makes sense: clock-mode, copy-mode, scroll-mode, send-keys,
send-prefix.
pull/1/head
Tiago Cunha 2009-08-20 11:37:46 +00:00
parent 52b02850ca
commit 36475f80e9
6 changed files with 28 additions and 34 deletions

View File

@ -1,4 +1,4 @@
/* $Id: cmd-clock-mode.c,v 1.5 2009-07-28 22:12:16 tcunha Exp $ */
/* $Id: cmd-clock-mode.c,v 1.6 2009-08-20 11:37:46 tcunha Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@ -28,7 +28,7 @@ int cmd_clock_mode_exec(struct cmd *, struct cmd_ctx *);
const struct cmd_entry cmd_clock_mode_entry = {
"clock-mode", NULL,
CMD_TARGET_WINDOW_USAGE,
CMD_TARGET_PANE_USAGE,
0, 0,
cmd_target_init,
cmd_target_parse,
@ -41,12 +41,12 @@ int
cmd_clock_mode_exec(struct cmd *self, struct cmd_ctx *ctx)
{
struct cmd_target_data *data = self->data;
struct winlink *wl;
struct window_pane *wp;
if ((wl = cmd_find_window(ctx, data->target, NULL)) == NULL)
if (cmd_find_pane(ctx, data->target, NULL, &wp) == NULL)
return (-1);
window_pane_set_mode(wl->window->active, &window_clock_mode);
window_pane_set_mode(wp, &window_clock_mode);
return (0);
}

View File

@ -1,4 +1,4 @@
/* $Id: cmd-copy-mode.c,v 1.22 2009-07-28 22:12:16 tcunha Exp $ */
/* $Id: cmd-copy-mode.c,v 1.23 2009-08-20 11:37:46 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -28,7 +28,7 @@ int cmd_copy_mode_exec(struct cmd *, struct cmd_ctx *);
const struct cmd_entry cmd_copy_mode_entry = {
"copy-mode", NULL,
"[-u] " CMD_TARGET_WINDOW_USAGE,
"[-u] " CMD_TARGET_PANE_USAGE,
0, CMD_CHFLAG('u'),
cmd_target_init,
cmd_target_parse,
@ -41,12 +41,10 @@ int
cmd_copy_mode_exec(struct cmd *self, struct cmd_ctx *ctx)
{
struct cmd_target_data *data = self->data;
struct winlink *wl;
struct window_pane *wp;
if ((wl = cmd_find_window(ctx, data->target, NULL)) == NULL)
if (cmd_find_pane(ctx, data->target, NULL, &wp) == NULL)
return (-1);
wp = wl->window->active;
window_pane_set_mode(wp, &window_copy_mode);
if (wp->mode == &window_copy_mode && data->chflags & CMD_CHFLAG('u'))

View File

@ -1,4 +1,4 @@
/* $Id: cmd-scroll-mode.c,v 1.22 2009-07-28 22:12:16 tcunha Exp $ */
/* $Id: cmd-scroll-mode.c,v 1.23 2009-08-20 11:37:46 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -29,7 +29,7 @@ int cmd_scroll_mode_exec(struct cmd *, struct cmd_ctx *);
const struct cmd_entry cmd_scroll_mode_entry = {
"scroll-mode", NULL,
"[-u] " CMD_TARGET_WINDOW_USAGE,
"[-u] " CMD_TARGET_PANE_USAGE,
0, CMD_CHFLAG('u'),
cmd_scroll_mode_init,
cmd_target_parse,
@ -57,12 +57,10 @@ int
cmd_scroll_mode_exec(struct cmd *self, struct cmd_ctx *ctx)
{
struct cmd_target_data *data = self->data;
struct winlink *wl;
struct window_pane *wp;
if ((wl = cmd_find_window(ctx, data->target, NULL)) == NULL)
if (cmd_find_pane(ctx, data->target, NULL, &wp) == NULL)
return (-1);
wp = wl->window->active;
window_pane_set_mode(wp, &window_scroll_mode);
if (wp->mode == &window_scroll_mode && data->chflags & CMD_CHFLAG('u'))

View File

@ -1,4 +1,4 @@
/* $Id: cmd-send-keys.c,v 1.20 2009-07-28 22:12:16 tcunha Exp $ */
/* $Id: cmd-send-keys.c,v 1.21 2009-08-20 11:37:46 tcunha Exp $ */
/*
* Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
@ -40,7 +40,7 @@ struct cmd_send_keys_data {
const struct cmd_entry cmd_send_keys_entry = {
"send-keys", "send",
"[-t target-window] key ...",
"[-t target-pane] key ...",
0, 0,
NULL,
cmd_send_keys_parse,
@ -106,19 +106,17 @@ int
cmd_send_keys_exec(struct cmd *self, struct cmd_ctx *ctx)
{
struct cmd_send_keys_data *data = self->data;
struct winlink *wl;
struct window_pane *wp;
u_int i;
if (data == NULL)
return (-1);
if ((wl = cmd_find_window(ctx, data->target, NULL)) == NULL)
if (cmd_find_pane(ctx, data->target, NULL, &wp) == NULL)
return (-1);
for (i = 0; i < data->nkeys; i++) {
window_pane_key(
wl->window->active, ctx->curclient, data->keys[i]);
}
for (i = 0; i < data->nkeys; i++)
window_pane_key(wp, ctx->curclient, data->keys[i]);
return (0);
}

View File

@ -1,4 +1,4 @@
/* $Id: cmd-send-prefix.c,v 1.25 2009-07-28 22:12:16 tcunha Exp $ */
/* $Id: cmd-send-prefix.c,v 1.26 2009-08-20 11:37:46 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -28,7 +28,7 @@ int cmd_send_prefix_exec(struct cmd *, struct cmd_ctx *);
const struct cmd_entry cmd_send_prefix_entry = {
"send-prefix", NULL,
CMD_TARGET_WINDOW_USAGE,
CMD_TARGET_PANE_USAGE,
0, 0,
cmd_target_init,
cmd_target_parse,
@ -42,14 +42,14 @@ cmd_send_prefix_exec(struct cmd *self, struct cmd_ctx *ctx)
{
struct cmd_target_data *data = self->data;
struct session *s;
struct winlink *wl;
struct window_pane *wp;
int key;
if ((wl = cmd_find_window(ctx, data->target, &s)) == NULL)
if (cmd_find_pane(ctx, data->target, &s, &wp) == NULL)
return (-1);
key = options_get_number(&s->options, "prefix");
window_pane_key(wl->window->active, ctx->curclient, key);
window_pane_key(wp, ctx->curclient, key);
return (0);
}

12
tmux.1
View File

@ -1,4 +1,4 @@
.\" $Id: tmux.1,v 1.153 2009-08-20 11:22:47 tcunha Exp $
.\" $Id: tmux.1,v 1.154 2009-08-20 11:37:46 tcunha Exp $
.\"
.\" Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
.\"
@ -528,7 +528,7 @@ The mode commands are as follows:
.Bl -tag -width Ds
.It Xo Ic copy-mode
.Op Fl u
.Op Fl t Ar target-window
.Op Fl t Ar target-pane
.Xc
Enter copy mode.
The
@ -536,7 +536,7 @@ The
option scrolls one page up.
.It Xo Ic scroll-mode
.Op Fl u
.Op Fl t Ar target-window
.Op Fl t Ar target-pane
.Xc
Enter scroll mode.
The
@ -970,7 +970,7 @@ are listed; this may be one of:
or
.Em emacs-copy .
.It Xo Ic send-keys
.Op Fl t Ar target-window
.Op Fl t Ar target-pane
.Ar key Ar ...
.Xc
.D1 (alias: Ic send )
@ -984,7 +984,7 @@ or
) to send; if the string is not recognised as a key, it is sent as a series of
characters.
All arguments are sent sequentially from first to last.
.It Ic send-prefix Op Fl t Ar target-window
.It Ic send-prefix Op Fl t Ar target-pane
Send the prefix key to a window as if it was pressed.
.It Xo Ic unbind-key
.Op Fl cn
@ -1799,7 +1799,7 @@ Display the contents of the specified buffer.
.Pp
Miscellaneous commands are as follows:
.Bl -tag -width Ds
.It Ic clock-mode Op Fl t Ar target-window
.It Ic clock-mode Op Fl t Ar target-pane
Display a large clock.
.It Ic if-shell Ar shell-command command
.D1 (alias: Ic if )