aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Marriott <nicholas.marriott@gmail.com>2009-01-28 22:00:22 +0000
committerNicholas Marriott <nicholas.marriott@gmail.com>2009-01-28 22:00:22 +0000
commit2057e666a2c2f7803b86640bcaeaa5c1e35ac58c (patch)
treef51579518ff5a12e74fe3300ac043e8cd7c705e4
parent4428987e955da1c56d1fcd98d2130f6a02738f1a (diff)
downloadrtmux-2057e666a2c2f7803b86640bcaeaa5c1e35ac58c.tar.gz
rtmux-2057e666a2c2f7803b86640bcaeaa5c1e35ac58c.tar.bz2
rtmux-2057e666a2c2f7803b86640bcaeaa5c1e35ac58c.zip
Mouse in copy mode.
-rw-r--r--CHANGES4
-rw-r--r--TODO2
-rw-r--r--window-choose.c4
-rw-r--r--window-copy.c32
4 files changed, 35 insertions, 7 deletions
diff --git a/CHANGES b/CHANGES
index 2147a210..fee33834 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,7 @@
28 January 2009
+* Support mouse in copy mode to move cursor. Can't do anything else at the
+ moment until other mouse modes are handled.
* Better support for at least the most common variant of mouse input: parse it
and adjust for different panes. Also support mouse in window/session choice
mode.
@@ -1035,7 +1037,7 @@
(including mutt, emacs). No status bar yet and no key remapping or other
customisation.
-$Id: CHANGES,v 1.239 2009-01-28 19:52:21 nicm Exp $
+$Id: CHANGES,v 1.240 2009-01-28 22:00:22 nicm Exp $
LocalWords: showw utf UTF fulvio ciriaco joshe OSC APC gettime abc DEF OA clr
LocalWords: rivo nurges lscm Erdely eol smysession mysession ek dstname RB ms
diff --git a/TODO b/TODO
index f52d436b..e51b1988 100644
--- a/TODO
+++ b/TODO
@@ -76,6 +76,7 @@
utf8 should work differently; could store as multiple cells, 1 of width >0
and n of width 0, then translate cursor indexes on-the-fly would need to
adjust all cursor movement and also handle different width lines properly.
+- support other mouse modes (highlight etc) and use it in copy mode
(hopefully) for 0.7, in no particular order:
- swap-pane-up, swap-pane-down (maybe move-pane-*)
@@ -89,5 +90,4 @@
- document find-window
- document split-window -p and -l
- attach should have a flag to create session if it doesn't exist
-- support mouse in copy mode
- fix page up/down in choice mode AGAIN
diff --git a/window-choose.c b/window-choose.c
index 2141fb1b..026cc075 100644
--- a/window-choose.c
+++ b/window-choose.c
@@ -1,4 +1,4 @@
-/* $Id: window-choose.c,v 1.8 2009-01-28 19:52:21 nicm Exp $ */
+/* $Id: window-choose.c,v 1.9 2009-01-28 22:00:22 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -257,7 +257,7 @@ window_choose_mouse(struct window_pane *wp,
struct window_choose_mode_item *item;
u_int idx;
- if ((b & 3) == 0)
+ if ((b & 3) == 3)
return;
if (x >= screen_size_x(s))
return;
diff --git a/window-copy.c b/window-copy.c
index 148d3a23..2e65ae76 100644
--- a/window-copy.c
+++ b/window-copy.c
@@ -1,4 +1,4 @@
-/* $Id: window-copy.c,v 1.48 2009-01-28 19:52:21 nicm Exp $ */
+/* $Id: window-copy.c,v 1.49 2009-01-28 22:00:22 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -26,6 +26,8 @@ struct screen *window_copy_init(struct window_pane *);
void window_copy_free(struct window_pane *);
void window_copy_resize(struct window_pane *, u_int, u_int);
void window_copy_key(struct window_pane *, struct client *, int);
+void window_copy_mouse(
+ struct window_pane *, struct client *, u_char, u_char, u_char);
void window_copy_redraw_lines(struct window_pane *, u_int, u_int);
void window_copy_redraw_screen(struct window_pane *);
@@ -64,7 +66,7 @@ const struct window_mode window_copy_mode = {
window_copy_free,
window_copy_resize,
window_copy_key,
- NULL,
+ window_copy_mouse,
NULL,
};
@@ -97,6 +99,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;
+
s->cx = data->cx;
s->cy = data->cy;
@@ -182,7 +186,7 @@ window_copy_key(struct window_pane *wp, struct client *c, int key)
window_copy_redraw_screen(wp);
break;
case MODEKEY_STARTSEL:
- window_copy_start_selection(wp);
+ window_copy_start_selection(wp);
break;
case MODEKEY_CLEARSEL:
screen_clear_selection(&data->screen);
@@ -213,6 +217,28 @@ window_copy_key(struct window_pane *wp, struct client *c, int key)
}
void
+window_copy_mouse(struct window_pane *wp,
+ unused struct client *c, u_char b, u_char x, u_char y)
+{
+ struct window_copy_mode_data *data = wp->modedata;
+ struct screen *s = &data->screen;
+
+ if ((b & 3) == 3)
+ return;
+ if (x >= screen_size_x(s))
+ return;
+ if (y >= screen_size_y(s))
+ return;
+
+ data->cx = x;
+ data->cy = y;
+
+ if (window_copy_update_selection(wp))
+ window_copy_redraw_screen(wp);
+ window_copy_update_cursor(wp);
+}
+
+void
window_copy_write_line(struct window_pane *wp, struct screen_write_ctx *ctx, u_int py)
{
struct window_copy_mode_data *data = wp->modedata;