diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2020-12-15 08:31:51 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2020-12-15 08:31:51 +0000 |
commit | 30ddfd59a5ddfcc13d0a1cc223928cd2c730300f (patch) | |
tree | 770e4a31902031e21bbf5f7168d0584d93a01980 /usr.bin/tmux/window.c | |
parent | 9f8a9186cff36c76d5fa7dd083ab2c849acf4738 (diff) |
Make synchronize-panes a pane option and add -U flag to set-option to
unset an option on all panes. GitHub issue 2491 from Rostislav Nesin.
Diffstat (limited to 'usr.bin/tmux/window.c')
-rw-r--r-- | usr.bin/tmux/window.c | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/usr.bin/tmux/window.c b/usr.bin/tmux/window.c index ea2cf05a4b9..d6ba1b30d89 100644 --- a/usr.bin/tmux/window.c +++ b/usr.bin/tmux/window.c @@ -1,4 +1,4 @@ -/* $OpenBSD: window.c,v 1.266 2020/06/13 09:05:53 nicm Exp $ */ +/* $OpenBSD: window.c,v 1.267 2020/12/15 08:31:50 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -1145,12 +1145,27 @@ window_pane_reset_mode_all(struct window_pane *wp) window_pane_reset_mode(wp); } +static void +window_pane_copy_key(struct window_pane *wp, key_code key) +{ + struct window_pane *loop; + + TAILQ_FOREACH(loop, &wp->window->panes, entry) { + if (loop != wp && + TAILQ_EMPTY(&loop->modes) && + loop->fd != -1 && + (~loop->flags & PANE_INPUTOFF) && + window_pane_visible(loop) && + options_get_number(loop->options, "synchronize-panes")) + input_key_pane(loop, key, NULL); + } +} + int window_pane_key(struct window_pane *wp, struct client *c, struct session *s, struct winlink *wl, key_code key, struct mouse_event *m) { struct window_mode_entry *wme; - struct window_pane *wp2; if (KEYC_IS_MOUSE(key) && m == NULL) return (-1); @@ -1172,16 +1187,8 @@ window_pane_key(struct window_pane *wp, struct client *c, struct session *s, if (KEYC_IS_MOUSE(key)) return (0); - if (options_get_number(wp->window->options, "synchronize-panes")) { - TAILQ_FOREACH(wp2, &wp->window->panes, entry) { - if (wp2 != wp && - TAILQ_EMPTY(&wp2->modes) && - wp2->fd != -1 && - (~wp2->flags & PANE_INPUTOFF) && - window_pane_visible(wp2)) - input_key_pane(wp2, key, NULL); - } - } + if (options_get_number(wp->options, "synchronize-panes")) + window_pane_copy_key(wp, key); return (0); } |