mirror of
https://github.com/tmux/tmux.git
synced 2025-09-01 20:57:00 +00:00
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.
This commit is contained in:
29
window.c
29
window.c
@ -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);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user