Add a mode-mouse option to prevent tmux taking over the mouse in choice or copy

modes.
This commit is contained in:
Nicholas Marriott 2009-07-30 07:04:50 +00:00
parent 2b331084b4
commit a419e73f7a
5 changed files with 15 additions and 5 deletions

View File

@ -60,6 +60,7 @@ const struct set_option_entry set_window_option_table[] = {
{ "mode-bg", SET_OPTION_COLOUR, 0, 0, NULL },
{ "mode-fg", SET_OPTION_COLOUR, 0, 0, NULL },
{ "mode-keys", SET_OPTION_CHOICE, 0, 0, set_option_mode_keys_list },
{ "mode-mouse", SET_OPTION_FLAG, 0, 0, NULL },
{ "monitor-activity", SET_OPTION_FLAG, 0, 0, NULL },
{ "monitor-content", SET_OPTION_STRING, 0, 0, NULL },
{ "remain-on-exit", SET_OPTION_FLAG, 0, 0, NULL },

10
tmux.1
View File

@ -1529,9 +1529,15 @@ Set window modes foreground colour.
.It Xo Ic mode-keys
.Op Ic vi | Ic emacs
.Xc
Use vi or emacs-style
key bindings in scroll and copy modes.
Use vi or emacs-style key bindings in scroll, copy and choice modes.
Key bindings default to emacs.
.It Xo Ic mode-mouse
.Op Ic on | Ic off
.Xc
Mouse state in modes. If on,
.Nm
will respond to mouse clicks by moving the cursor in copy mode or selecting an
option in choice mode.
.It Xo Ic monitor-activity
.Op Ic on | Ic off
.Xc

3
tmux.c
View File

@ -378,12 +378,13 @@ main(int argc, char **argv)
options_set_number(&global_w_options, "clock-mode-style", 1);
options_set_number(&global_w_options, "force-height", 0);
options_set_number(&global_w_options, "force-width", 0);
options_set_number(&global_w_options, "mode-attr", GRID_ATTR_REVERSE);
options_set_number(&global_w_options, "main-pane-width", 81);
options_set_number(&global_w_options, "main-pane-height", 24);
options_set_number(&global_w_options, "mode-attr", GRID_ATTR_REVERSE);
options_set_number(&global_w_options, "mode-bg", 3);
options_set_number(&global_w_options, "mode-fg", 0);
options_set_number(&global_w_options, "mode-keys", MODEKEY_EMACS);
options_set_number(&global_w_options, "mode-mouse", 1);
options_set_number(&global_w_options, "monitor-activity", 0);
options_set_string(&global_w_options, "monitor-content", "%s", "");
if (flags & IDENTIFY_UTF8)

View File

@ -123,7 +123,8 @@ window_choose_init(struct window_pane *wp)
s = &data->screen;
screen_init(s, screen_size_x(&wp->base), screen_size_y(&wp->base), 0);
s->mode &= ~MODE_CURSOR;
s->mode |= MODE_MOUSE;
if (options_get_number(&wp->window->options, "mode-mouse"))
s->mode |= MODE_MOUSE;
keys = options_get_number(&wp->window->options, "mode-keys");
if (keys == MODEKEY_EMACS)

View File

@ -104,7 +104,8 @@ window_copy_init(struct window_pane *wp)
s = &data->screen;
screen_init(s, screen_size_x(&wp->base), screen_size_y(&wp->base), 0);
s->mode |= MODE_MOUSE;
if (options_get_number(&wp->window->options, "mode-mouse"))
s->mode |= MODE_MOUSE;
keys = options_get_number(&wp->window->options, "mode-keys");
if (keys == MODEKEY_EMACS)