diff options
author | 2009-10-09 07:27:00 +0000 | |
---|---|---|
committer | 2009-10-09 07:27:00 +0000 | |
commit | 9274c26a45140bcc69d103f7211b5f19e036a179 (patch) | |
tree | 7ce632477d539885c8920bcaa3de2a190de04071 /usr.bin/tmux/window.c | |
parent | Be less aggressive about turning the cursor off, only explicitly turn it off (diff) | |
download | wireguard-openbsd-9274c26a45140bcc69d103f7211b5f19e036a179.tar.xz wireguard-openbsd-9274c26a45140bcc69d103f7211b5f19e036a179.zip |
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.
Diffstat (limited to 'usr.bin/tmux/window.c')
-rw-r--r-- | usr.bin/tmux/window.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/usr.bin/tmux/window.c b/usr.bin/tmux/window.c index 07396c8d7c2..9521b230d87 100644 --- a/usr.bin/tmux/window.c +++ b/usr.bin/tmux/window.c @@ -1,4 +1,4 @@ -/* $OpenBSD: window.c,v 1.26 2009/09/20 14:58:12 nicm Exp $ */ +/* $OpenBSD: window.c,v 1.27 2009/10/09 07:27:00 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -610,14 +610,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 |