diff options
Diffstat (limited to 'cmd-copy-mode.c')
-rw-r--r-- | cmd-copy-mode.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/cmd-copy-mode.c b/cmd-copy-mode.c index bdb8245e..5ce7a2c4 100644 --- a/cmd-copy-mode.c +++ b/cmd-copy-mode.c @@ -30,9 +30,10 @@ const struct cmd_entry cmd_copy_mode_entry = { .name = "copy-mode", .alias = NULL, - .args = { "eHMt:uq", 0, 0 }, - .usage = "[-eHMuq] " CMD_TARGET_PANE_USAGE, + .args = { "eHMs:t:uq", 0, 0 }, + .usage = "[-eHMuq] [-s src-pane] " CMD_TARGET_PANE_USAGE, + .source = { 's', CMD_FIND_PANE, 0 }, .target = { 't', CMD_FIND_PANE, 0 }, .flags = CMD_AFTERHOOK, @@ -59,7 +60,7 @@ cmd_copy_mode_exec(struct cmd *self, struct cmdq_item *item) struct cmdq_shared *shared = item->shared; struct client *c = item->client; struct session *s; - struct window_pane *wp = item->target.wp; + struct window_pane *wp = item->target.wp, *swp; if (args_has(args, 'q')) { window_pane_reset_mode_all(wp); @@ -74,11 +75,15 @@ cmd_copy_mode_exec(struct cmd *self, struct cmdq_item *item) } if (self->entry == &cmd_clock_mode_entry) { - window_pane_set_mode(wp, &window_clock_mode, NULL, NULL); + window_pane_set_mode(wp, NULL, &window_clock_mode, NULL, NULL); return (CMD_RETURN_NORMAL); } - if (!window_pane_set_mode(wp, &window_copy_mode, NULL, args)) { + if (args_has(args, 's')) + swp = item->source.wp; + else + swp = wp; + if (!window_pane_set_mode(wp, swp, &window_copy_mode, NULL, args)) { if (args_has(args, 'M')) window_copy_start_drag(c, &shared->mouse); } |