From de730f68a4bc97e26f8f5dcb404ed27dc489c0fd Mon Sep 17 00:00:00 2001 From: nicm Date: Fri, 8 Mar 2019 10:34:20 +0000 Subject: Make the mode used to view command output (a variant of copy mode) use its own mode definition struct with a different init function rather than calling special setup functions. --- cmd-queue.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'cmd-queue.c') diff --git a/cmd-queue.c b/cmd-queue.c index ccb25c9a..2a95a3e5 100644 --- a/cmd-queue.c +++ b/cmd-queue.c @@ -404,10 +404,10 @@ cmdq_guard(struct cmdq_item *item, const char *guard, int flags) void cmdq_print(struct cmdq_item *item, const char *fmt, ...) { - struct client *c = item->client; - struct window *w; - va_list ap; - char *tmp, *msg; + struct client *c = item->client; + struct window_pane *wp; + va_list ap; + char *tmp, *msg; va_start(ap, fmt); @@ -425,9 +425,12 @@ cmdq_print(struct cmdq_item *item, const char *fmt, ...) evbuffer_add(c->stdout_data, "\n", 1); server_client_push_stdout(c); } else { - w = c->session->curw->window; - window_copy_init_for_output(w->active); - window_copy_vadd(w->active, fmt, ap); + wp = c->session->curw->window->active; + if (wp->mode == NULL || wp->mode->mode != &window_view_mode) { + window_pane_reset_mode(wp); + window_pane_set_mode(wp, &window_view_mode, NULL, NULL); + } + window_copy_vadd(wp, fmt, ap); } va_end(ap); -- cgit