mirror of
https://github.com/tmux/tmux.git
synced 2025-01-07 16:28:48 +00:00
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.
This commit is contained in:
parent
dc6271cd79
commit
145ba777e8
@ -28,7 +28,7 @@ int cmd_clock_mode_exec(struct cmd *, struct cmd_ctx *);
|
|||||||
|
|
||||||
const struct cmd_entry cmd_clock_mode_entry = {
|
const struct cmd_entry cmd_clock_mode_entry = {
|
||||||
"clock-mode", NULL,
|
"clock-mode", NULL,
|
||||||
CMD_TARGET_WINDOW_USAGE,
|
CMD_TARGET_PANE_USAGE,
|
||||||
0, 0,
|
0, 0,
|
||||||
cmd_target_init,
|
cmd_target_init,
|
||||||
cmd_target_parse,
|
cmd_target_parse,
|
||||||
@ -41,12 +41,12 @@ int
|
|||||||
cmd_clock_mode_exec(struct cmd *self, struct cmd_ctx *ctx)
|
cmd_clock_mode_exec(struct cmd *self, struct cmd_ctx *ctx)
|
||||||
{
|
{
|
||||||
struct cmd_target_data *data = self->data;
|
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);
|
return (-1);
|
||||||
|
|
||||||
window_pane_set_mode(wl->window->active, &window_clock_mode);
|
window_pane_set_mode(wp, &window_clock_mode);
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ int cmd_copy_mode_exec(struct cmd *, struct cmd_ctx *);
|
|||||||
|
|
||||||
const struct cmd_entry cmd_copy_mode_entry = {
|
const struct cmd_entry cmd_copy_mode_entry = {
|
||||||
"copy-mode", NULL,
|
"copy-mode", NULL,
|
||||||
"[-u] " CMD_TARGET_WINDOW_USAGE,
|
"[-u] " CMD_TARGET_PANE_USAGE,
|
||||||
0, CMD_CHFLAG('u'),
|
0, CMD_CHFLAG('u'),
|
||||||
cmd_target_init,
|
cmd_target_init,
|
||||||
cmd_target_parse,
|
cmd_target_parse,
|
||||||
@ -41,12 +41,10 @@ int
|
|||||||
cmd_copy_mode_exec(struct cmd *self, struct cmd_ctx *ctx)
|
cmd_copy_mode_exec(struct cmd *self, struct cmd_ctx *ctx)
|
||||||
{
|
{
|
||||||
struct cmd_target_data *data = self->data;
|
struct cmd_target_data *data = self->data;
|
||||||
struct winlink *wl;
|
|
||||||
struct window_pane *wp;
|
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);
|
return (-1);
|
||||||
wp = wl->window->active;
|
|
||||||
|
|
||||||
window_pane_set_mode(wp, &window_copy_mode);
|
window_pane_set_mode(wp, &window_copy_mode);
|
||||||
if (wp->mode == &window_copy_mode && data->chflags & CMD_CHFLAG('u'))
|
if (wp->mode == &window_copy_mode && data->chflags & CMD_CHFLAG('u'))
|
||||||
|
@ -29,7 +29,7 @@ int cmd_scroll_mode_exec(struct cmd *, struct cmd_ctx *);
|
|||||||
|
|
||||||
const struct cmd_entry cmd_scroll_mode_entry = {
|
const struct cmd_entry cmd_scroll_mode_entry = {
|
||||||
"scroll-mode", NULL,
|
"scroll-mode", NULL,
|
||||||
"[-u] " CMD_TARGET_WINDOW_USAGE,
|
"[-u] " CMD_TARGET_PANE_USAGE,
|
||||||
0, CMD_CHFLAG('u'),
|
0, CMD_CHFLAG('u'),
|
||||||
cmd_scroll_mode_init,
|
cmd_scroll_mode_init,
|
||||||
cmd_target_parse,
|
cmd_target_parse,
|
||||||
@ -57,12 +57,10 @@ int
|
|||||||
cmd_scroll_mode_exec(struct cmd *self, struct cmd_ctx *ctx)
|
cmd_scroll_mode_exec(struct cmd *self, struct cmd_ctx *ctx)
|
||||||
{
|
{
|
||||||
struct cmd_target_data *data = self->data;
|
struct cmd_target_data *data = self->data;
|
||||||
struct winlink *wl;
|
|
||||||
struct window_pane *wp;
|
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);
|
return (-1);
|
||||||
wp = wl->window->active;
|
|
||||||
|
|
||||||
window_pane_set_mode(wp, &window_scroll_mode);
|
window_pane_set_mode(wp, &window_scroll_mode);
|
||||||
if (wp->mode == &window_scroll_mode && data->chflags & CMD_CHFLAG('u'))
|
if (wp->mode == &window_scroll_mode && data->chflags & CMD_CHFLAG('u'))
|
||||||
|
@ -40,7 +40,7 @@ struct cmd_send_keys_data {
|
|||||||
|
|
||||||
const struct cmd_entry cmd_send_keys_entry = {
|
const struct cmd_entry cmd_send_keys_entry = {
|
||||||
"send-keys", "send",
|
"send-keys", "send",
|
||||||
"[-t target-window] key ...",
|
"[-t target-pane] key ...",
|
||||||
0, 0,
|
0, 0,
|
||||||
NULL,
|
NULL,
|
||||||
cmd_send_keys_parse,
|
cmd_send_keys_parse,
|
||||||
@ -106,19 +106,17 @@ int
|
|||||||
cmd_send_keys_exec(struct cmd *self, struct cmd_ctx *ctx)
|
cmd_send_keys_exec(struct cmd *self, struct cmd_ctx *ctx)
|
||||||
{
|
{
|
||||||
struct cmd_send_keys_data *data = self->data;
|
struct cmd_send_keys_data *data = self->data;
|
||||||
struct winlink *wl;
|
struct window_pane *wp;
|
||||||
u_int i;
|
u_int i;
|
||||||
|
|
||||||
if (data == NULL)
|
if (data == NULL)
|
||||||
return (-1);
|
return (-1);
|
||||||
|
|
||||||
if ((wl = cmd_find_window(ctx, data->target, NULL)) == NULL)
|
if (cmd_find_pane(ctx, data->target, NULL, &wp) == NULL)
|
||||||
return (-1);
|
return (-1);
|
||||||
|
|
||||||
for (i = 0; i < data->nkeys; i++) {
|
for (i = 0; i < data->nkeys; i++)
|
||||||
window_pane_key(
|
window_pane_key(wp, ctx->curclient, data->keys[i]);
|
||||||
wl->window->active, ctx->curclient, data->keys[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ int cmd_send_prefix_exec(struct cmd *, struct cmd_ctx *);
|
|||||||
|
|
||||||
const struct cmd_entry cmd_send_prefix_entry = {
|
const struct cmd_entry cmd_send_prefix_entry = {
|
||||||
"send-prefix", NULL,
|
"send-prefix", NULL,
|
||||||
CMD_TARGET_WINDOW_USAGE,
|
CMD_TARGET_PANE_USAGE,
|
||||||
0, 0,
|
0, 0,
|
||||||
cmd_target_init,
|
cmd_target_init,
|
||||||
cmd_target_parse,
|
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 cmd_target_data *data = self->data;
|
||||||
struct session *s;
|
struct session *s;
|
||||||
struct winlink *wl;
|
struct window_pane *wp;
|
||||||
int key;
|
int key;
|
||||||
|
|
||||||
if ((wl = cmd_find_window(ctx, data->target, &s)) == NULL)
|
if (cmd_find_pane(ctx, data->target, &s, &wp) == NULL)
|
||||||
return (-1);
|
return (-1);
|
||||||
|
|
||||||
key = options_get_number(&s->options, "prefix");
|
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);
|
return (0);
|
||||||
}
|
}
|
||||||
|
10
tmux.1
10
tmux.1
@ -528,7 +528,7 @@ The mode commands are as follows:
|
|||||||
.Bl -tag -width Ds
|
.Bl -tag -width Ds
|
||||||
.It Xo Ic copy-mode
|
.It Xo Ic copy-mode
|
||||||
.Op Fl u
|
.Op Fl u
|
||||||
.Op Fl t Ar target-window
|
.Op Fl t Ar target-pane
|
||||||
.Xc
|
.Xc
|
||||||
Enter copy mode.
|
Enter copy mode.
|
||||||
The
|
The
|
||||||
@ -536,7 +536,7 @@ The
|
|||||||
option scrolls one page up.
|
option scrolls one page up.
|
||||||
.It Xo Ic scroll-mode
|
.It Xo Ic scroll-mode
|
||||||
.Op Fl u
|
.Op Fl u
|
||||||
.Op Fl t Ar target-window
|
.Op Fl t Ar target-pane
|
||||||
.Xc
|
.Xc
|
||||||
Enter scroll mode.
|
Enter scroll mode.
|
||||||
The
|
The
|
||||||
@ -970,7 +970,7 @@ are listed; this may be one of:
|
|||||||
or
|
or
|
||||||
.Em emacs-copy .
|
.Em emacs-copy .
|
||||||
.It Xo Ic send-keys
|
.It Xo Ic send-keys
|
||||||
.Op Fl t Ar target-window
|
.Op Fl t Ar target-pane
|
||||||
.Ar key Ar ...
|
.Ar key Ar ...
|
||||||
.Xc
|
.Xc
|
||||||
.D1 (alias: Ic send )
|
.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
|
) to send; if the string is not recognised as a key, it is sent as a series of
|
||||||
characters.
|
characters.
|
||||||
All arguments are sent sequentially from first to last.
|
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.
|
Send the prefix key to a window as if it was pressed.
|
||||||
.It Xo Ic unbind-key
|
.It Xo Ic unbind-key
|
||||||
.Op Fl cn
|
.Op Fl cn
|
||||||
@ -1799,7 +1799,7 @@ Display the contents of the specified buffer.
|
|||||||
.Pp
|
.Pp
|
||||||
Miscellaneous commands are as follows:
|
Miscellaneous commands are as follows:
|
||||||
.Bl -tag -width Ds
|
.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.
|
Display a large clock.
|
||||||
.It Ic if-shell Ar shell-command command
|
.It Ic if-shell Ar shell-command command
|
||||||
.D1 (alias: Ic if )
|
.D1 (alias: Ic if )
|
||||||
|
Loading…
Reference in New Issue
Block a user