diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2019-03-12 11:16:51 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2019-03-12 11:16:51 +0000 |
commit | c456969731f70c3030cafcfcd4a67fc5aa1cd36c (patch) | |
tree | fc1ae91d94379b8a09eecfb31ee3be5e7c6f59df /usr.bin/tmux/cmd-copy-mode.c | |
parent | bf3b2b3954f062c42cec536e1c766d1d41097483 (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 'usr.bin/tmux/cmd-copy-mode.c')
-rw-r--r-- | usr.bin/tmux/cmd-copy-mode.c | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/usr.bin/tmux/cmd-copy-mode.c b/usr.bin/tmux/cmd-copy-mode.c index 77e03fc43f2..635df2a394f 100644 --- a/usr.bin/tmux/cmd-copy-mode.c +++ b/usr.bin/tmux/cmd-copy-mode.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-copy-mode.c,v 1.36 2019/03/08 10:34:20 nicm Exp $ */ +/* $OpenBSD: cmd-copy-mode.c,v 1.37 2019/03/12 11:16:49 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -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); |