diff options
author | Nicholas Marriott <nicm@openbsd.org> | 2012-11-27 20:22:12 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@openbsd.org> | 2012-11-27 20:22:12 +0000 |
commit | 47c097cb51da9622180963af5391d142e7d4ade3 (patch) | |
tree | 89a59136eb48394945f0ddfda370c762d240f51b /input-keys.c | |
parent | 24d7d073fffbf5137176ef474f13f4cfe1f032e9 (diff) |
Support middle-click paste, based on a diff from Ailin Nemui.
Diffstat (limited to 'input-keys.c')
-rw-r--r-- | input-keys.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/input-keys.c b/input-keys.c index eee469e8..2111f5f3 100644 --- a/input-keys.c +++ b/input-keys.c @@ -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; } } |