1
0
mirror of https://github.com/tmate-io/tmate-ssh-server.git synced 2020-11-18 19:53:51 -08:00

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.
This commit is contained in:
Nicholas Marriott 2011-07-30 18:01:26 +00:00
parent be179f6d7e
commit cc5bcbfb59
3 changed files with 14 additions and 3 deletions

View File

@ -204,6 +204,7 @@ input_mouse(struct window_pane *wp, struct mouse_event *m)
{ {
char buf[10]; char buf[10];
size_t len; size_t len;
int value;
if (wp->screen->mode & ALL_MOUSE_MODES) { if (wp->screen->mode & ALL_MOUSE_MODES) {
if (wp->screen->mode & MODE_MOUSE_UTF8) { 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); bufferevent_write(wp->event, buf, len);
} else if ((m->b & MOUSE_BUTTON) != MOUSE_2) { } 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_pane_set_mode(wp, &window_copy_mode) == 0) {
window_copy_init_from_pane(wp); window_copy_init_from_pane(wp);
if (wp->mode->mouse != NULL) if (wp->mode->mouse != NULL)

View File

@ -36,6 +36,9 @@
const char *options_table_mode_keys_list[] = { const char *options_table_mode_keys_list[] = {
"emacs", "vi", NULL "emacs", "vi", NULL
}; };
const char *options_table_mode_mouse_list[] = {
"off", "on", "copy-mode", NULL
};
const char *options_table_clock_mode_style_list[] = { const char *options_table_clock_mode_style_list[] = {
"12", "24", NULL "12", "24", NULL
}; };
@ -484,7 +487,8 @@ const struct options_table_entry window_options_table[] = {
}, },
{ .name = "mode-mouse", { .name = "mode-mouse",
.type = OPTIONS_TABLE_FLAG, .type = OPTIONS_TABLE_CHOICE,
.choices = options_table_mode_mouse_list,
.default_num = 0 .default_num = 0
}, },

7
tmux.1
View File

@ -2358,12 +2358,17 @@ contains
.Ql vi . .Ql vi .
.Pp .Pp
.It Xo Ic mode-mouse .It Xo Ic mode-mouse
.Op Ic on | off .Op Ic on | off | copy-mode
.Xc .Xc
Mouse state in modes. Mouse state in modes.
If on, the mouse may be used to enter copy mode and copy a selection by 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 dragging, to enter copy mode and scroll with the mouse wheel, or to select an
option in choice mode. 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 .Pp
.It Xo Ic monitor-activity .It Xo Ic monitor-activity
.Op Ic on | off .Op Ic on | off