From d1337053b6119c4aab0c38b5fc082acf2fdfcbb1 Mon Sep 17 00:00:00 2001 From: nicm Date: Tue, 21 Apr 2015 15:34:32 +0000 Subject: [PATCH] Bind mouse dragging so that it is passed through to applications if they want it rather than entering copy mode. --- cmd-copy-mode.c | 5 ++++- key-bindings.c | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/cmd-copy-mode.c b/cmd-copy-mode.c index 19dca5ff..d729ada6 100644 --- a/cmd-copy-mode.c +++ b/cmd-copy-mode.c @@ -68,8 +68,11 @@ cmd_copy_mode_exec(struct cmd *self, struct cmd_q *cmdq) return (CMD_RETURN_NORMAL); window_copy_init_from_pane(wp); } - if (args_has(args, 'M')) + if (args_has(args, 'M')) { + if (wp->mode != NULL && wp->mode != &window_copy_mode) + return (CMD_RETURN_NORMAL); window_copy_start_drag(c, &cmdq->item->mouse); + } if (wp->mode == &window_copy_mode && args_has(self->args, 'u')) window_copy_pageup(wp); diff --git a/key-bindings.c b/key-bindings.c index c34db710..670300a7 100644 --- a/key-bindings.c +++ b/key-bindings.c @@ -221,7 +221,7 @@ key_bindings_init(void) "bind -n MouseDown1Pane select-pane -t=\\; send-keys -M", "bind -n MouseDrag1Border resize-pane -M", "bind -n MouseDown1Status select-window -t=", - "bind -n MouseDrag1Pane copy-mode -M", + "bind -n MouseDrag1Pane if -Ft= '#{mouse_any_flag}' 'if -Ft= \"#{pane_in_mode}\" \"copy-mode -M\" \"send-keys -M\"' 'copy-mode -M'", }; u_int i; struct cmd_list *cmdlist;