From 9ac062acef348331e768db82554a214860b348af Mon Sep 17 00:00:00 2001 From: Tiago Cunha Date: Fri, 9 Oct 2009 13:07:04 +0000 Subject: Sync OpenBSD patchset 367: Add a simple synchronize-panes window option: when set, all input to any pane that is part of the window is also sent to all other panes in the same window. Suggested by several, most recently Tomasz Pajor. --- window.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'window.c') diff --git a/window.c b/window.c index dad19cd1..52954f77 100644 --- a/window.c +++ b/window.c @@ -1,4 +1,4 @@ -/* $Id: window.c,v 1.109 2009-09-23 16:09:12 nicm Exp $ */ +/* $Id: window.c,v 1.110 2009-10-09 13:07:04 tcunha Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -617,14 +617,26 @@ window_pane_parse(struct window_pane *wp) void window_pane_key(struct window_pane *wp, struct client *c, int key) { + struct window_pane *wp2; + if (wp->fd == -1 || !window_pane_visible(wp)) return; if (wp->mode != NULL) { if (wp->mode->key != NULL) wp->mode->key(wp, c, key); - } else - input_key(wp, key); + return; + } + + input_key(wp, key); + if (options_get_number(&wp->window->options, "synchronize-panes")) { + TAILQ_FOREACH(wp2, &wp->window->panes, entry) { + if (wp2 == wp || wp2->mode != NULL) + continue; + if (wp2->fd != -1 && window_pane_visible(wp2)) + input_key(wp2, key); + } + } } void -- cgit