aboutsummaryrefslogtreecommitdiff
path: root/cmd-copy-mode.c
diff options
context:
space:
mode:
authorThomas Adam <thomas@xteddy.org>2020-04-13 10:30:00 +0100
committerThomas Adam <thomas@xteddy.org>2020-04-13 10:30:00 +0100
commitb117c3b81217a11946ac784cfbe2ef1f3725b207 (patch)
tree196cc4a27cb75def4466d418cb91dd3fcfdfbf5b /cmd-copy-mode.c
parent52e3d960e7ebe2006509d48c427ffd8f25a0cf52 (diff)
parentc20eb0c0ae3347c768894a6355adfd7ebae6f2f3 (diff)
downloadrtmux-b117c3b81217a11946ac784cfbe2ef1f3725b207.tar.gz
rtmux-b117c3b81217a11946ac784cfbe2ef1f3725b207.tar.bz2
rtmux-b117c3b81217a11946ac784cfbe2ef1f3725b207.zip
Merge branch 'obsd-master'
Diffstat (limited to 'cmd-copy-mode.c')
-rw-r--r--cmd-copy-mode.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/cmd-copy-mode.c b/cmd-copy-mode.c
index bdb8245e..3b20689c 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,
@@ -55,11 +56,11 @@ const struct cmd_entry cmd_clock_mode_entry = {
static enum cmd_retval
cmd_copy_mode_exec(struct cmd *self, struct cmdq_item *item)
{
- struct args *args = self->args;
+ struct args *args = cmd_get_args(self);
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);
@@ -73,16 +74,20 @@ cmd_copy_mode_exec(struct cmd *self, struct cmdq_item *item)
return (CMD_RETURN_NORMAL);
}
- if (self->entry == &cmd_clock_mode_entry) {
- window_pane_set_mode(wp, &window_clock_mode, NULL, NULL);
+ if (cmd_get_entry(self) == &cmd_clock_mode_entry) {
+ 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);
}
- if (args_has(self->args, 'u'))
+ if (args_has(args, 'u'))
window_copy_pageup(wp, 0);
return (CMD_RETURN_NORMAL);