summaryrefslogtreecommitdiffstats
path: root/usr.bin/tmux/input-keys.c
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2012-11-27 20:22:12 +0000
committernicm <nicm@openbsd.org>2012-11-27 20:22:12 +0000
commit7a3aab4efb9ba3115a1bf31c2bca19c7329ca554 (patch)
tree3b79c895182e05f65924bea4af8e49ff4fcc42ea /usr.bin/tmux/input-keys.c
parentSupport the 47 and 1047 SM and RM sequences (alternate screen without (diff)
downloadwireguard-openbsd-7a3aab4efb9ba3115a1bf31c2bca19c7329ca554.tar.xz
wireguard-openbsd-7a3aab4efb9ba3115a1bf31c2bca19c7329ca554.zip
Support middle-click paste, based on a diff from Ailin Nemui.
Diffstat (limited to 'usr.bin/tmux/input-keys.c')
-rw-r--r--usr.bin/tmux/input-keys.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/usr.bin/tmux/input-keys.c b/usr.bin/tmux/input-keys.c
index c8642fc615e..67140a35d1e 100644
--- a/usr.bin/tmux/input-keys.c
+++ b/usr.bin/tmux/input-keys.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: input-keys.c,v 1.29 2012/11/27 14:26:48 nicm Exp $ */
+/* $OpenBSD: input-keys.c,v 1.30 2012/11/27 20:22:12 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -202,8 +202,9 @@ input_key(struct window_pane *wp, int key)
void
input_mouse(struct window_pane *wp, struct session *s, struct mouse_event *m)
{
- char buf[10];
- size_t len;
+ char buf[10];
+ size_t len;
+ struct paste_buffer *pb;
if (wp->screen->mode & ALL_MOUSE_MODES) {
if (wp->screen->mode & MODE_MOUSE_UTF8) {
@@ -223,13 +224,19 @@ input_mouse(struct window_pane *wp, struct session *s, struct mouse_event *m)
return;
}
- if ((m->xb & 3) != 1 &&
+ if (m->button == 1 && (m->event & MOUSE_EVENT_CLICK) &&
+ options_get_number(&wp->window->options, "mode-mouse") == 1) {
+ pb = paste_get_top(&global_buffers);
+ if (pb != NULL) {
+ paste_send_pane(pb, wp, "\r",
+ wp->screen->mode & MODE_BRACKETPASTE);
+ }
+ } else if ((m->xb & 3) != 1 &&
options_get_number(&wp->window->options, "mode-mouse") == 1) {
if (window_pane_set_mode(wp, &window_copy_mode) == 0) {
window_copy_init_from_pane(wp);
if (wp->mode->mouse != NULL)
wp->mode->mouse(wp, s, m);
}
- return;
}
}