mirror of
https://github.com/tmux/tmux.git
synced 2025-01-06 07:48: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 = {
|
||||
"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);
|
||||
}
|
||||
|
@ -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'))
|
||||
|
@ -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'))
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
10
tmux.1
10
tmux.1
@ -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 )
|
||||
|
Loading…
Reference in New Issue
Block a user