diff options
author | Tiago Cunha <tcunha@gmx.com> | 2009-10-09 13:07:04 +0000 |
---|---|---|
committer | Tiago Cunha <tcunha@gmx.com> | 2009-10-09 13:07:04 +0000 |
commit | 9ac062acef348331e768db82554a214860b348af (patch) | |
tree | 7fda79848b62f7fa8ae75ecb653a3cdc4de1f89d | |
parent | 765a38e5348a5336af7299729ad933e4b9cf5a4d (diff) | |
download | rtmux-9ac062acef348331e768db82554a214860b348af.tar.gz rtmux-9ac062acef348331e768db82554a214860b348af.tar.bz2 rtmux-9ac062acef348331e768db82554a214860b348af.zip |
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.
-rw-r--r-- | cmd-set-window-option.c | 3 | ||||
-rw-r--r-- | tmux.1 | 9 | ||||
-rw-r--r-- | tmux.c | 3 | ||||
-rw-r--r-- | window.c | 18 |
4 files changed, 26 insertions, 7 deletions
diff --git a/cmd-set-window-option.c b/cmd-set-window-option.c index c683aa9f..864c80d4 100644 --- a/cmd-set-window-option.c +++ b/cmd-set-window-option.c @@ -1,4 +1,4 @@ -/* $Id: cmd-set-window-option.c,v 1.39 2009-09-22 14:22:20 tcunha Exp $ */ +/* $Id: cmd-set-window-option.c,v 1.40 2009-10-09 13:07:04 tcunha Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net> @@ -64,6 +64,7 @@ const struct set_option_entry set_window_option_table[] = { { "monitor-activity", SET_OPTION_FLAG, 0, 0, NULL }, { "monitor-content", SET_OPTION_STRING, 0, 0, NULL }, { "remain-on-exit", SET_OPTION_FLAG, 0, 0, NULL }, + { "synchronize-panes", SET_OPTION_FLAG, 0, 0, NULL }, { "utf8", SET_OPTION_FLAG, 0, 0, NULL }, { "window-status-attr", SET_OPTION_ATTRIBUTES, 0, 0, NULL }, { "window-status-bg", SET_OPTION_COLOUR, 0, 0, NULL }, @@ -1,4 +1,4 @@ -.\" $Id: tmux.1,v 1.180 2009-10-07 17:13:59 tcunha Exp $ +.\" $Id: tmux.1,v 1.181 2009-10-09 13:07:04 tcunha Exp $ .\" .\" Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> .\" @@ -14,7 +14,7 @@ .\" IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING .\" OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: October 7 2009 $ +.Dd $Mdocdate: October 9 2009 $ .Dt TMUX 1 .Os .Sh NAME @@ -1662,6 +1662,11 @@ The window may be reactivated with the .Ic respawn-window command. .Pp +.It Xo Ic synchronize-panes +.Op Ic on | off +.Xc +Duplicate input to any pane to all other panes in the same window, except +for panes that are not in output mode. .It Xo Ic utf8 .Op Ic on | off .Xc @@ -1,4 +1,4 @@ -/* $Id: tmux.c,v 1.175 2009-09-23 15:18:56 tcunha Exp $ */ +/* $Id: tmux.c,v 1.176 2009-10-09 13:07:04 tcunha Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -450,6 +450,7 @@ main(int argc, char **argv) options_set_number(wo, "window-status-fg", 8); options_set_number(wo, "xterm-keys", 0); options_set_number(wo, "remain-on-exit", 0); + options_set_number(wo, "synchronize-panes", 0); if (flags & IDENTIFY_UTF8) { options_set_number(so, "status-utf8", 1); @@ -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 <nicm@users.sourceforge.net> @@ -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 |