summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2017-02-08 17:33:52 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2017-02-08 17:33:52 +0000
commit36db65d39d5ee1624a117b67188d207c70645637 (patch)
treedcabfcc878afb0243a24ce94360c06f82e5d1cd6 /usr.bin
parent580a5b4e0199d8cead6ea8dd24661c3e868a9504 (diff)
window_copy_pagedown shouldn't reset the mode anymore, instead let the
caller do it so it can free the marks. Problem reported by attila at stalphonsos dot com.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/tmux/window-copy.c30
1 files changed, 18 insertions, 12 deletions
diff --git a/usr.bin/tmux/window-copy.c b/usr.bin/tmux/window-copy.c
index ec562620650..0bad6c6fa92 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.165 2017/02/03 11:57:28 nicm Exp $ */
+/* $OpenBSD: window-copy.c,v 1.166 2017/02/08 17:33:51 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -29,7 +29,7 @@ static void window_copy_command(struct window_pane *, struct client *,
struct session *, struct args *, struct mouse_event *);
static struct screen *window_copy_init(struct window_pane *);
static void window_copy_free(struct window_pane *);
-static void window_copy_pagedown(struct window_pane *, int);
+static int window_copy_pagedown(struct window_pane *, int);
static void window_copy_next_paragraph(struct window_pane *);
static void window_copy_previous_paragraph(struct window_pane *);
static void window_copy_resize(struct window_pane *, u_int, u_int);
@@ -380,7 +380,7 @@ window_copy_pageup(struct window_pane *wp, int half_page)
window_copy_redraw_screen(wp);
}
-static void
+static int
window_copy_pagedown(struct window_pane *wp, int half_page)
{
struct window_copy_mode_data *data = wp->modedata;
@@ -420,13 +420,11 @@ window_copy_pagedown(struct window_pane *wp, int half_page)
window_copy_cursor_end_of_line(wp);
}
- if (data->scroll_exit && data->oy == 0) {
- window_pane_reset_mode(wp);
- return;
- }
-
+ if (data->scroll_exit && data->oy == 0)
+ return (1);
window_copy_update_selection(wp, 1);
window_copy_redraw_screen(wp);
+ return (0);
}
static void
@@ -621,8 +619,12 @@ window_copy_command(struct window_pane *wp, struct client *c, struct session *s,
if (strcmp(command, "end-of-line") == 0)
window_copy_cursor_end_of_line(wp);
if (strcmp(command, "halfpage-down") == 0) {
- for (; np != 0; np--)
- window_copy_pagedown(wp, 1);
+ for (; np != 0; np--) {
+ if (window_copy_pagedown(wp, 1)) {
+ cancel = 1;
+ break;
+ }
+ }
}
if (strcmp(command, "halfpage-up") == 0) {
for (; np != 0; np--)
@@ -715,8 +717,12 @@ window_copy_command(struct window_pane *wp, struct client *c, struct session *s,
window_copy_other_end(wp);
}
if (strcmp(command, "page-down") == 0) {
- for (; np != 0; np--)
- window_copy_pagedown(wp, 0);
+ for (; np != 0; np--) {
+ if (window_copy_pagedown(wp, 0)) {
+ cancel = 1;
+ break;
+ }
+ }
}
if (strcmp(command, "page-up") == 0) {
for (; np != 0; np--)