summaryrefslogtreecommitdiff
path: root/usr.bin/tmux
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2011-07-30 18:01:27 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2011-07-30 18:01:27 +0000
commitbf59037af026e89ecc7ac063ca02fafa76908d3e (patch)
tree6d4d83688d945ed9b70a43c361559392f8c98362 /usr.bin/tmux
parente6b3f8d1d32fe473849f2aa21ecd4332c376dcad (diff)
Extend the mode-mouse option to add a third choice which means the mouse
does not enter copy mode. Patch from SF bug 3374493. In future the mode-mouse option is likely to die and be broken into several smaller options.
Diffstat (limited to 'usr.bin/tmux')
-rw-r--r--usr.bin/tmux/input-keys.c6
-rw-r--r--usr.bin/tmux/options-table.c8
-rw-r--r--usr.bin/tmux/tmux.111
3 files changed, 18 insertions, 7 deletions
diff --git a/usr.bin/tmux/input-keys.c b/usr.bin/tmux/input-keys.c
index de09ad65468..157ce5a3a07 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.22 2011/04/19 21:31:33 nicm Exp $ */
+/* $OpenBSD: input-keys.c,v 1.23 2011/07/30 18:01:26 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -204,6 +204,7 @@ input_mouse(struct window_pane *wp, struct mouse_event *m)
{
char buf[10];
size_t len;
+ int value;
if (wp->screen->mode & ALL_MOUSE_MODES) {
if (wp->screen->mode & MODE_MOUSE_UTF8) {
@@ -221,7 +222,8 @@ input_mouse(struct window_pane *wp, struct mouse_event *m)
}
bufferevent_write(wp->event, buf, len);
} else if ((m->b & MOUSE_BUTTON) != MOUSE_2) {
- if (options_get_number(&wp->window->options, "mode-mouse") &&
+ value = options_get_number(&wp->window->options, "mode-mouse");
+ if (value == 1 &&
window_pane_set_mode(wp, &window_copy_mode) == 0) {
window_copy_init_from_pane(wp);
if (wp->mode->mouse != NULL)
diff --git a/usr.bin/tmux/options-table.c b/usr.bin/tmux/options-table.c
index a45f4ea6819..80b107b2592 100644
--- a/usr.bin/tmux/options-table.c
+++ b/usr.bin/tmux/options-table.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: options-table.c,v 1.11 2011/07/03 19:07:54 nicm Exp $ */
+/* $OpenBSD: options-table.c,v 1.12 2011/07/30 18:01:26 nicm Exp $ */
/*
* Copyright (c) 2011 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -36,6 +36,9 @@
const char *options_table_mode_keys_list[] = {
"emacs", "vi", NULL
};
+const char *options_table_mode_mouse_list[] = {
+ "off", "on", "copy-mode", NULL
+};
const char *options_table_clock_mode_style_list[] = {
"12", "24", NULL
};
@@ -484,7 +487,8 @@ const struct options_table_entry window_options_table[] = {
},
{ .name = "mode-mouse",
- .type = OPTIONS_TABLE_FLAG,
+ .type = OPTIONS_TABLE_CHOICE,
+ .choices = options_table_mode_mouse_list,
.default_num = 0
},
diff --git a/usr.bin/tmux/tmux.1 b/usr.bin/tmux/tmux.1
index cc640b54594..e40d26a2abb 100644
--- a/usr.bin/tmux/tmux.1
+++ b/usr.bin/tmux/tmux.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: tmux.1,v 1.239 2011/07/25 09:57:28 nicm Exp $
+.\" $OpenBSD: tmux.1,v 1.240 2011/07/30 18:01:26 nicm Exp $
.\"
.\" Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
.\"
@@ -14,7 +14,7 @@
.\" IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
.\" OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: July 25 2011 $
+.Dd $Mdocdate: July 30 2011 $
.Dt TMUX 1
.Os
.Sh NAME
@@ -2358,12 +2358,17 @@ contains
.Ql vi .
.Pp
.It Xo Ic mode-mouse
-.Op Ic on | off
+.Op Ic on | off | copy-mode
.Xc
Mouse state in modes.
If on, the mouse may be used to enter copy mode and copy a selection by
dragging, to enter copy mode and scroll with the mouse wheel, or to select an
option in choice mode.
+If set to
+.Em
+copy-mode ,
+the mouse behaves as set to on, but cannot be used to enter copy
+mode.
.Pp
.It Xo Ic monitor-activity
.Op Ic on | off