Update of /cvsroot/tmux/tmux
In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv7212
Modified Files:
tmux.1 tmux.h tty-keys.c tty.c window-copy.c
Log Message:
Sync OpenBSD patchset 710:
When the mode-mouse option is on, support dragging to make a selection
in copy mode.
Also support the scroll wheel, although xterm strangely does not ignore
it in application mouse mode, causing redraw artifacts when scrolling up
(other terminals appear to be better behaved).
Index: tty.c
===================================================================
RCS file: /cvsroot/tmux/tmux/tty.c,v
retrieving revision 1.189
retrieving revision 1.190
diff -u -d -r1.189 -r1.190
--- tty.c 8 Mar 2010 14:53:49 -0000 1.189
+++ tty.c 6 Jun 2010 00:23:44 -0000 1.190
@@ -402,11 +402,18 @@
else
tty_putcode(tty, TTYC_CIVIS);
}
- if (changed & MODE_MOUSE) {
- if (mode & MODE_MOUSE)
- tty_puts(tty, "\033[?1000h");
- else
- tty_puts(tty, "\033[?1000l");
+ if (changed & (MODE_MOUSE|MODE_MOUSEMOTION)) {
+ if (mode & MODE_MOUSE) {
+ if (mode & MODE_MOUSEMOTION)
+ tty_puts(tty, "\033[?1003h");
+ else
+ tty_puts(tty, "\033[?1000h");
+ } else {
+ if (mode & MODE_MOUSEMOTION)
+ tty_puts(tty, "\033[?1003l");
+ else
+ tty_puts(tty, "\033[?1000l");
+ }
}
if (changed & MODE_KKEYPAD) {
if (mode & MODE_KKEYPAD)
Index: window-copy.c
===================================================================
RCS file: /cvsroot/tmux/tmux/window-copy.c,v
retrieving revision 1.119
retrieving revision 1.120
diff -u -d -r1.119 -r1.120
--- window-copy.c 5 Jun 2010 20:29:11 -0000 1.119
+++ window-copy.c 6 Jun 2010 00:23:44 -0000 1.120
@@ -760,17 +760,61 @@
{
struct window_copy_mode_data *data = wp->modedata;
struct screen *s = &data->screen;
+ u_int i;
+
+ /*
+ * xterm mouse mode is fairly silly. Buttons are in the bottom two
+ * bits: 0 button 1; 1 button 2; 2 button 3; 3 buttons released.
+ *
+ * Bit 3 is shift; bit 4 is meta; bit 5 control.
+ *
+ * Bit 6 is added for mouse buttons 4 and 5.
+ */
- if ((m->b & 3) == 3)
- return;
if (m->x >= screen_size_x(s))
return;
if (m->y >= screen_size_y(s))
return;
- window_copy_update_cursor(wp, m->x, m->y);
- if (window_copy_update_selection(wp))
+ /* If mouse wheel (buttons 4 and 5), scroll. */
+ if ((m->b & 64) == 64) {
+ if ((m->b & 3) == 0) {
+ for (i = 0; i < 5; i++)
+ window_copy_cursor_up(wp, 0);
+ } else if ((m->b & 3) == 1) {
+ for (i = 0; i < 5; i++)
+ window_copy_cursor_down(wp, 0);
+ }
+ return;
+ }
+
+ /*
+ * If already reading motion, move the cursor while buttons are still
+ * pressed, or stop the selection on their release.
+ */
+ if (s->mode & MODE_MOUSEMOTION) {
+ if ((m->b & 3) != 3) {
+ window_copy_update_cursor(wp, m->x, m->y);
+ if (window_copy_update_selection(wp))
+ window_copy_redraw_screen(wp);
+ } else {
+ s->mode &= ~MODE_MOUSEMOTION;
+ if (sess != NULL) {
+ window_copy_copy_selection(wp, sess);
+ window_pane_reset_mode(wp);
+ }
+ }
+ return;
+ }
+
+ /* Otherwise i other buttons pressed, start selection and motion. */
+ if ((m->b & 3) != 3) {
+ s->mode |= MODE_MOUSEMOTION;
+
+ window_copy_update_cursor(wp, m->x, m->y);
+ window_copy_start_selection(wp);
window_copy_redraw_screen(wp);
+ }
}
void
Index: tmux.1
===================================================================
RCS file: /cvsroot/tmux/tmux/tmux.1,v
retrieving revision 1.254
retrieving revision 1.255
diff -u -d -r1.254 -r1.255
--- tmux.1 6 Jun 2010 00:21:36 -0000 1.254
+++ tmux.1 6 Jun 2010 00:23:44 -0000 1.255
@@ -14,7 +14,7 @@
.\" IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
.\" OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: May 30 2010 $
+.Dd $Mdocdate: May 31 2010 $
.Dt TMUX 1
.Os
.Sh NAME
@@ -2078,10 +2078,8 @@
.Op Ic on | 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.
+If on, the mouse may be used to copy a selection by dragging in copy mode, or
+to select an option in choice mode.
.Pp
.It Xo Ic monitor-activity
.Op Ic on | off
Index: tmux.h
===================================================================
RCS file: /cvsroot/tmux/tmux/tmux.h,v
retrieving revision 1.559
retrieving revision 1.560
diff -u -d -r1.559 -r1.560
--- tmux.h 5 Jun 2010 20:29:11 -0000 1.559
+++ tmux.h 6 Jun 2010 00:23:44 -0000 1.560
@@ -544,7 +544,8 @@
#define MODE_KCURSOR 0x4
#define MODE_KKEYPAD 0x8 /* set = application, clear = number */
#define MODE_MOUSE 0x10
-#define MODE_WRAP 0x20 /* whether lines wrap */
+#define MODE_MOUSEMOTION 0x20
+#define MODE_WRAP 0x40 /* whether lines wrap */
/*
* A single UTF-8 character.
@@ -1089,7 +1090,7 @@
#define CLIENT_TERMINAL 0x1
#define CLIENT_PREFIX 0x2
-#define CLIENT_MOUSE 0x4
+/* 0x4 unused */
#define CLIENT_REDRAW 0x8
#define CLIENT_STATUS 0x10
#define CLIENT_REPEAT 0x20 /* allow command to repeat within repeat time */
Index: tty-keys.c
===================================================================
RCS file: /cvsroot/tmux/tmux/tty-keys.c,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -d -r1.56 -r1.57
--- tty-keys.c 15 Mar 2010 20:44:51 -0000 1.56
+++ tty-keys.c 6 Jun 2010 00:23:44 -0000 1.57
@@ -612,7 +612,8 @@
return (1);
*size = 6;
- log_debug("mouse input is: %.6s", buf);
+ log_debug(
+ "mouse input: %.6s (%hhu,%hhu/%hhu)", buf, buf[4], buf[5], buf[3]);
m->b = buf[3];
m->x = buf[4];
------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit. See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
tmux-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tmux-cvs