summaryrefslogtreecommitdiff
path: root/usr.bin/tmux
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2014-12-15 10:02:56 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2014-12-15 10:02:56 +0000
commit56cadb7b207a6a28f0a3c8f4b3e63ffd43a1599e (patch)
tree993d6c312ce80b7ffa6c07b84239e6ad0e3ca6bc /usr.bin/tmux
parentc7756b9e7414519ea01e5b187d3423b64e3a5c1c (diff)
Only redraw affected lines when selection changes with mouse. From
Michael Graczyk.
Diffstat (limited to 'usr.bin/tmux')
-rw-r--r--usr.bin/tmux/window-copy.c25
1 files changed, 22 insertions, 3 deletions
diff --git a/usr.bin/tmux/window-copy.c b/usr.bin/tmux/window-copy.c
index dcdbe53cf14..9ec92184a1c 100644
--- a/usr.bin/tmux/window-copy.c
+++ b/usr.bin/tmux/window-copy.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: window-copy.c,v 1.120 2014/11/09 15:13:01 nicm Exp $ */
+/* $OpenBSD: window-copy.c,v 1.121 2014/12/15 10:02:55 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -33,6 +33,7 @@ int window_copy_key_numeric_prefix(struct window_pane *, int);
void window_copy_mouse(struct window_pane *, struct session *,
struct mouse_event *);
+void window_copy_redraw_selection(struct window_pane *, u_int);
void window_copy_redraw_lines(struct window_pane *, u_int, u_int);
void window_copy_redraw_screen(struct window_pane *);
void window_copy_write_line(struct window_pane *, struct screen_write_ctx *,
@@ -874,7 +875,7 @@ window_copy_mouse(struct window_pane *wp, struct session *sess,
{
struct window_copy_mode_data *data = wp->modedata;
struct screen *s = &data->screen;
- u_int i;
+ u_int i, old_cy;
if (m->x >= screen_size_x(s))
return;
@@ -907,9 +908,10 @@ window_copy_mouse(struct window_pane *wp, struct session *sess,
*/
if (s->mode & MODE_MOUSE_BUTTON) {
if (~m->event & MOUSE_EVENT_UP) {
+ old_cy = data->cy;
window_copy_update_cursor(wp, m->x, m->y);
if (window_copy_update_selection(wp, 1))
- window_copy_redraw_screen(wp);
+ window_copy_redraw_selection(wp, old_cy);
return;
}
goto reset_mode;
@@ -1246,6 +1248,23 @@ window_copy_write_lines(struct window_pane *wp, struct screen_write_ctx *ctx,
}
void
+window_copy_redraw_selection(struct window_pane *wp, u_int old_y)
+{
+ struct window_copy_mode_data *data = wp->modedata;
+ u_int new_y, start, end;
+
+ new_y = data->cy;
+ if (old_y <= new_y) {
+ start = old_y;
+ end = new_y;
+ } else {
+ start = new_y;
+ end = old_y;
+ }
+ window_copy_redraw_lines(wp, start, end - start + 1);
+}
+
+void
window_copy_redraw_lines(struct window_pane *wp, u_int py, u_int ny)
{
struct window_copy_mode_data *data = wp->modedata;