summaryrefslogtreecommitdiffstats
path: root/cmd-copy-mode.c
diff options
context:
space:
mode:
authornicm <nicm>2019-03-12 11:16:49 +0000
committernicm <nicm>2019-03-12 11:16:49 +0000
commit3f6bfbaf2babcc7f08f628a82ff31b0b52014e58 (patch)
treece4bf0c954cdfede0c2e86905bd85a9f565ed370 /cmd-copy-mode.c
parentff4c80d53df96bb46eaa64107673e42d402f0d49 (diff)
Allow multiple modes to be open in a pane. A stack of open modes is kept
and the previous restored when the top is exited. If a mode that is already on the stack is entered, the existing instance is moved to the top as the active mode rather than being opened new.
Diffstat (limited to 'cmd-copy-mode.c')
-rw-r--r--cmd-copy-mode.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/cmd-copy-mode.c b/cmd-copy-mode.c
index d9471aab..bd05f8a2 100644
--- a/cmd-copy-mode.c
+++ b/cmd-copy-mode.c
@@ -60,7 +60,6 @@ cmd_copy_mode_exec(struct cmd *self, struct cmdq_item *item)
struct client *c = item->client;
struct session *s;
struct window_pane *wp = item->target.wp;
- int flag;
if (args_has(args, 'M')) {
if ((wp = cmd_mouse_pane(&shared->mouse, &s, NULL)) == NULL)
@@ -74,16 +73,10 @@ cmd_copy_mode_exec(struct cmd *self, struct cmdq_item *item)
return (CMD_RETURN_NORMAL);
}
- if (wp->mode == NULL || wp->mode->mode != &window_copy_mode) {
- flag = window_pane_set_mode(wp, &window_copy_mode, NULL, args);
- if (flag != 0)
- return (CMD_RETURN_NORMAL);
- }
- if (args_has(args, 'M')) {
- if (wp->mode != NULL && wp->mode->mode != &window_copy_mode)
- return (CMD_RETURN_NORMAL);
+ if (window_pane_set_mode(wp, &window_copy_mode, NULL, args) != 0)
+ return (CMD_RETURN_NORMAL);
+ if (args_has(args, 'M'))
window_copy_start_drag(c, &shared->mouse);
- }
if (args_has(self->args, 'u'))
window_copy_pageup(wp, 0);