Hi,
when working with this mouse stuff it occurred to me that really the
mode-mouse option is only about the copy-mode, and its name is quite
misleading. Thus attached patch is what I would see fit. But obviously,
this will probably break a lot of user-configs (bla foo no option
mode-mouse).. I couldn't find any previous case of variable rename in
tmux history..
?
#Regards\Marcel.
>From 8c2919547ad673832b5ce957d55e7c2b63265de8 Mon Sep 17 00:00:00 2001
From: Marcel Partap <mpar...@gmx.net>
Date: Sun, 24 Jun 2012 23:17:06 +0200
Subject: [PATCH] Rename mode-mouse option to mouse-copy-mode, always enable
 mouse in choose mode

---
 trunk/input-keys.c    |    2 +-
 trunk/options-table.c |    8 ++++----
 trunk/server-client.c |    2 +-
 trunk/tmux.1          |    9 ++++-----
 trunk/window-choose.c |    3 +--
 trunk/window-copy.c   |    2 +-
 trunk/window.c        |    2 +-
 7 files changed, 13 insertions(+), 15 deletions(-)

diff --git a/trunk/input-keys.c b/trunk/input-keys.c
index ea1fb92..3642528 100644
--- a/trunk/input-keys.c
+++ b/trunk/input-keys.c
@@ -223,7 +223,7 @@ input_mouse(struct window_pane *wp, struct mouse_event *m)
 	}
 
 	if ((m->b & 3) != 1 &&
-	    options_get_number(&wp->window->options, "mode-mouse") == 1) {
+	    options_get_number(&wp->window->options, "mouse-copy-mode") == 1) {
 		if (window_pane_set_mode(wp, &window_copy_mode) == 0) {
 			window_copy_init_from_pane(wp);
 			if (wp->mode->mouse != NULL)
diff --git a/trunk/options-table.c b/trunk/options-table.c
index 8ce838a..e3e4362 100644
--- a/trunk/options-table.c
+++ b/trunk/options-table.c
@@ -35,8 +35,8 @@
 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_mouse_copy_mode_list[] = {
+	"off", "on", "within", NULL
 };
 const char *options_table_clock_mode_style_list[] = {
 	"12", "24", NULL
@@ -551,9 +551,9 @@ const struct options_table_entry window_options_table[] = {
 	  .default_num = MODEKEY_EMACS
 	},
 
-	{ .name = "mode-mouse",
+	{ .name = "mouse-copy-mode",
 	  .type = OPTIONS_TABLE_CHOICE,
-	  .choices = options_table_mode_mouse_list,
+	  .choices = options_table_mouse_copy_mode_list,
 	  .default_num = 0
 	},
 
diff --git a/trunk/server-client.c b/trunk/server-client.c
index a678a12..758f3ba 100644
--- a/trunk/server-client.c
+++ b/trunk/server-client.c
@@ -546,7 +546,7 @@ server_client_reset_state(struct client *c)
 			mode |= MODE_MOUSE_STANDARD;
 		else if (options_get_number(oo, "mouse-select-window"))
 			mode |= MODE_MOUSE_STANDARD;
-		else if (options_get_number(wo, "mode-mouse"))
+		else if (options_get_number(wo, "mouse-copy-mode"))
 			mode |= MODE_MOUSE_STANDARD;
 	}
 
diff --git a/trunk/tmux.1 b/trunk/tmux.1
index 7062890..64cdf63 100644
--- a/trunk/tmux.1
+++ b/trunk/tmux.1
@@ -2608,15 +2608,14 @@ or
 contains
 .Ql vi .
 .Pp
-.It Xo Ic mode-mouse
-.Op Ic on | off | copy-mode
+.It Xo Ic mouse-copy-mode
+.Op Ic on | off | within
 .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.
+dragging, to enter copy mode and scroll with the mouse wheel.
 If set to
-.Em copy-mode ,
+.Em within ,
 the mouse behaves as set to on, but cannot be used to enter copy
 mode.
 .Pp
diff --git a/trunk/window-choose.c b/trunk/window-choose.c
index 7e14cf5..c955833 100644
--- a/trunk/window-choose.c
+++ b/trunk/window-choose.c
@@ -127,8 +127,7 @@ 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;
-	if (options_get_number(&wp->window->options, "mode-mouse"))
-		s->mode |= MODE_MOUSE_STANDARD;
+	s->mode |= MODE_MOUSE_STANDARD;
 
 	keys = options_get_number(&wp->window->options, "mode-keys");
 	if (keys == MODEKEY_EMACS)
diff --git a/trunk/window-copy.c b/trunk/window-copy.c
index 7b2a8ae..1c8aa00 100644
--- a/trunk/window-copy.c
+++ b/trunk/window-copy.c
@@ -182,7 +182,7 @@ window_copy_init(struct window_pane *wp)
 
 	s = &data->screen;
 	screen_init(s, screen_size_x(&wp->base), screen_size_y(&wp->base), 0);
-	if (options_get_number(&wp->window->options, "mode-mouse"))
+	if (options_get_number(&wp->window->options, "mouse-copy-mode"))
 		s->mode |= MODE_MOUSE_STANDARD;
 
 	keys = options_get_number(&wp->window->options, "mode-keys");
diff --git a/trunk/window.c b/trunk/window.c
index 8eb11f2..7f90c08 100644
--- a/trunk/window.c
+++ b/trunk/window.c
@@ -1022,7 +1022,7 @@ window_pane_mouse(
 
 	if (wp->mode != NULL) {
 		if (wp->mode->mouse != NULL &&
-		    options_get_number(&wp->window->options, "mode-mouse"))
+		    options_get_number(&wp->window->options, "mouse-copy-mode"))
 			wp->mode->mouse(wp, sess, m);
 	} else if (wp->fd != -1)
 		input_mouse(wp, m);
-- 
1.7.10.4

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users

Reply via email to