summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2017-11-03 14:23:45 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2017-11-03 14:23:45 +0000
commit46f68c1628fa702f0777e59dfeb70caa728f6fbc (patch)
treea3eeeedbcee1e08bfcf2af9560b9f9b0311657bb /usr.bin
parent2fa739b3186baab5c5ba81e159df50b0b5d32645 (diff)
Change mouse in modes so that one click moves the cursor and a double
click chooses the line.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/tmux/mode-tree.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/usr.bin/tmux/mode-tree.c b/usr.bin/tmux/mode-tree.c
index 12261643bd4..737efa6d4ee 100644
--- a/usr.bin/tmux/mode-tree.c
+++ b/usr.bin/tmux/mode-tree.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mode-tree.c,v 1.17 2017/11/02 22:00:42 nicm Exp $ */
+/* $OpenBSD: mode-tree.c,v 1.18 2017/11/03 14:23:44 nicm Exp $ */
/*
* Copyright (c) 2017 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -726,7 +726,7 @@ mode_tree_key(struct mode_tree_data *mtd, struct client *c, key_code *key,
int choice;
key_code tmp;
- if (*key == KEYC_MOUSEDOWN1_PANE) {
+ if (KEYC_IS_MOUSE(*key)) {
if (cmd_mouse_at(mtd->wp, m, &x, &y, 0) != 0) {
*key = KEYC_NONE;
return (0);
@@ -736,8 +736,11 @@ mode_tree_key(struct mode_tree_data *mtd, struct client *c, key_code *key,
return (0);
}
if (mtd->offset + y < mtd->line_size) {
- mtd->current = mtd->offset + y;
- *key = '\r';
+ if (*key == KEYC_MOUSEDOWN1_PANE ||
+ *key == KEYC_DOUBLECLICK1_PANE)
+ mtd->current = mtd->offset + y;
+ if (*key == KEYC_DOUBLECLICK1_PANE)
+ *key = '\r';
return (0);
}
}