summaryrefslogtreecommitdiff
path: root/usr.bin/tmux
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2019-03-07 19:34:23 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2019-03-07 19:34:23 +0000
commit2c99347e69e9d4204d01c39c2491d19f5ecc8b3f (patch)
treeb6dc3f26930875fe2103fb3eeabd36d1ecab93e5 /usr.bin/tmux
parentdf419e7e1b181177191c282801b4d5447d5f3d41 (diff)
Tidy changing the mode into window_copy_init_for_output.
Diffstat (limited to 'usr.bin/tmux')
-rw-r--r--usr.bin/tmux/cfg.c3
-rw-r--r--usr.bin/tmux/cmd-queue.c9
-rw-r--r--usr.bin/tmux/cmd-run-shell.c8
-rw-r--r--usr.bin/tmux/window-copy.c8
4 files changed, 13 insertions, 15 deletions
diff --git a/usr.bin/tmux/cfg.c b/usr.bin/tmux/cfg.c
index a6479d884ce..4e7811092ac 100644
--- a/usr.bin/tmux/cfg.c
+++ b/usr.bin/tmux/cfg.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cfg.c,v 1.63 2019/02/16 11:42:08 nicm Exp $ */
+/* $OpenBSD: cfg.c,v 1.64 2019/03/07 19:34:22 nicm Exp $ */
/*
* Copyright (c) 2008 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -348,7 +348,6 @@ cfg_show_causes(struct session *s)
return;
wp = s->curw->window->active;
- window_pane_set_mode(wp, &window_copy_mode, NULL, NULL);
window_copy_init_for_output(wp);
for (i = 0; i < cfg_ncauses; i++) {
window_copy_add(wp, "%s", cfg_causes[i]);
diff --git a/usr.bin/tmux/cmd-queue.c b/usr.bin/tmux/cmd-queue.c
index a5896acab47..1d49333c60d 100644
--- a/usr.bin/tmux/cmd-queue.c
+++ b/usr.bin/tmux/cmd-queue.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-queue.c,v 1.58 2017/08/30 10:33:57 nicm Exp $ */
+/* $OpenBSD: cmd-queue.c,v 1.59 2019/03/07 19:34:22 nicm Exp $ */
/*
* Copyright (c) 2013 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -426,12 +426,7 @@ cmdq_print(struct cmdq_item *item, const char *fmt, ...)
server_client_push_stdout(c);
} else {
w = c->session->curw->window;
- if (w->active->mode != &window_copy_mode) {
- window_pane_reset_mode(w->active);
- window_pane_set_mode(w->active, &window_copy_mode, NULL,
- NULL);
- window_copy_init_for_output(w->active);
- }
+ window_copy_init_for_output(w->active);
window_copy_vadd(w->active, fmt, ap);
}
diff --git a/usr.bin/tmux/cmd-run-shell.c b/usr.bin/tmux/cmd-run-shell.c
index cbb4a888cc9..29ffcb440b8 100644
--- a/usr.bin/tmux/cmd-run-shell.c
+++ b/usr.bin/tmux/cmd-run-shell.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-run-shell.c,v 1.55 2018/08/27 11:03:34 nicm Exp $ */
+/* $OpenBSD: cmd-run-shell.c,v 1.56 2019/03/07 19:34:22 nicm Exp $ */
/*
* Copyright (c) 2009 Tiago Cunha <me@tiagocunha.org>
@@ -75,10 +75,8 @@ cmd_run_shell_print(struct job *job, const char *msg)
return;
}
- if (window_pane_set_mode(wp, &window_copy_mode, NULL, NULL) == 0)
- window_copy_init_for_output(wp);
- if (wp->mode == &window_copy_mode)
- window_copy_add(wp, "%s", msg);
+ window_copy_init_for_output(wp);
+ window_copy_add(wp, "%s", msg);
}
static enum cmd_retval
diff --git a/usr.bin/tmux/window-copy.c b/usr.bin/tmux/window-copy.c
index a18347b2e23..cef728b83ab 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.206 2019/03/07 19:01:21 nicm Exp $ */
+/* $OpenBSD: window-copy.c,v 1.207 2019/03/07 19:34:22 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -263,6 +263,12 @@ window_copy_init_for_output(struct window_pane *wp)
{
struct window_copy_mode_data *data = wp->modedata;
+ if (wp->mode == &window_copy_mode && data->backing != &wp->base)
+ return;
+ window_pane_reset_mode(wp);
+ window_pane_set_mode(wp, &window_copy_mode, NULL, NULL);
+
+ data = wp->modedata;
data->backing = xmalloc(sizeof *data->backing);
screen_init(data->backing, screen_size_x(&wp->base),
screen_size_y(&wp->base), UINT_MAX);