summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2009-07-30 07:04:50 +0000
committerNicholas Marriott <nicm@openbsd.org>2009-07-30 07:04:50 +0000
commita419e73f7a356ef3d63f79e3b870fbd4defd74bc (patch)
tree38d3b32c6aeb06b692a16adeae5bceb9624cce7b
parent2b331084b4c69dafac6e2bb1d5b02193666cf0e0 (diff)
Add a mode-mouse option to prevent tmux taking over the mouse in choice or copy
modes.
-rw-r--r--cmd-set-window-option.c1
-rw-r--r--tmux.110
-rw-r--r--tmux.c3
-rw-r--r--window-choose.c3
-rw-r--r--window-copy.c3
5 files changed, 15 insertions, 5 deletions
diff --git a/cmd-set-window-option.c b/cmd-set-window-option.c
index c24f3592..1d90425d 100644
--- a/cmd-set-window-option.c
+++ b/cmd-set-window-option.c
@@ -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 },
diff --git a/tmux.1 b/tmux.1
index 06bc76bd..81a987c7 100644
--- a/tmux.1
+++ b/tmux.1
@@ -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
diff --git a/tmux.c b/tmux.c
index 3845022d..dd7b83f5 100644
--- a/tmux.c
+++ b/tmux.c
@@ -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)
diff --git a/window-choose.c b/window-choose.c
index e7d847de..b1d9192a 100644
--- a/window-choose.c
+++ b/window-choose.c
@@ -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)
diff --git a/window-copy.c b/window-copy.c
index 8ea32126..340c9c75 100644
--- a/window-copy.c
+++ b/window-copy.c
@@ -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)