Sync OpenBSD patchset 198:

Add a mode-mouse option to prevent tmux taking over the mouse in choice or
copy modes.
pull/1/head
Tiago Cunha 2009-07-30 20:32:05 +00:00
parent 8ce1f0b047
commit ec3dba01b2
5 changed files with 20 additions and 10 deletions

View File

@ -1,4 +1,4 @@
/* $Id: cmd-set-window-option.c,v 1.35 2009-07-28 22:12:16 tcunha Exp $ */
/* $Id: cmd-set-window-option.c,v 1.36 2009-07-30 20:32:05 tcunha Exp $ */
/*
* Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
@ -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 },

12
tmux.1
View File

@ -1,4 +1,4 @@
.\" $Id: tmux.1,v 1.135 2009-07-28 23:19:06 tcunha Exp $
.\" $Id: tmux.1,v 1.136 2009-07-30 20:32:05 tcunha Exp $
.\"
.\" Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
.\"
@ -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

5
tmux.c
View File

@ -1,4 +1,4 @@
/* $Id: tmux.c,v 1.152 2009-07-30 20:21:55 tcunha Exp $ */
/* $Id: tmux.c,v 1.153 2009-07-30 20:32:05 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -387,12 +387,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

@ -1,4 +1,4 @@
/* $Id: window-choose.c,v 1.20 2009-07-28 23:11:18 tcunha Exp $ */
/* $Id: window-choose.c,v 1.21 2009-07-30 20:32:05 tcunha Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@ -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

@ -1,4 +1,4 @@
/* $Id: window-copy.c,v 1.71 2009-07-28 23:11:18 tcunha Exp $ */
/* $Id: window-copy.c,v 1.72 2009-07-30 20:32:05 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -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)