summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.bin/tmux/cmd-set-option.c23
-rw-r--r--usr.bin/tmux/format.c4
-rw-r--r--usr.bin/tmux/options-table.c4
-rw-r--r--usr.bin/tmux/tmux.123
-rw-r--r--usr.bin/tmux/window.c31
5 files changed, 55 insertions, 30 deletions
diff --git a/usr.bin/tmux/cmd-set-option.c b/usr.bin/tmux/cmd-set-option.c
index 6c05a004b3c..abf97055db7 100644
--- a/usr.bin/tmux/cmd-set-option.c
+++ b/usr.bin/tmux/cmd-set-option.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-set-option.c,v 1.137 2020/06/16 08:18:34 nicm Exp $ */
+/* $OpenBSD: cmd-set-option.c,v 1.138 2020/12/15 08:31:50 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -33,8 +33,8 @@ const struct cmd_entry cmd_set_option_entry = {
.name = "set-option",
.alias = "set",
- .args = { "aFgopqst:uw", 1, 2 },
- .usage = "[-aFgopqsuw] " CMD_TARGET_PANE_USAGE " option [value]",
+ .args = { "aFgopqst:uUw", 1, 2 },
+ .usage = "[-aFgopqsuUw] " CMD_TARGET_PANE_USAGE " option [value]",
.target = { 't', CMD_FIND_PANE, CMD_FIND_CANFAIL },
@@ -74,8 +74,9 @@ cmd_set_option_exec(struct cmd *self, struct cmdq_item *item)
struct args *args = cmd_get_args(self);
int append = args_has(args, 'a');
struct cmd_find_state *target = cmdq_get_target(item);
+ struct window_pane *loop;
struct options *oo;
- struct options_entry *parent, *o;
+ struct options_entry *parent, *o, *po;
char *name, *argument, *value = NULL, *cause;
int window, idx, already, error, ambiguous;
int scope;
@@ -148,7 +149,19 @@ cmd_set_option_exec(struct cmd *self, struct cmdq_item *item)
}
/* Change the option. */
- if (args_has(args, 'u')) {
+ if (args_has(args, 'U') && scope == OPTIONS_TABLE_WINDOW) {
+ TAILQ_FOREACH(loop, &target->w->panes, entry) {
+ po = options_get_only(loop->options, name);
+ if (po == NULL)
+ continue;
+ if (options_remove_or_default(po, idx, &cause) != 0) {
+ cmdq_error(item, "%s", cause);
+ free(cause);
+ goto fail;
+ }
+ }
+ }
+ if (args_has(args, 'u') || args_has(args, 'U')) {
if (o == NULL)
goto out;
if (options_remove_or_default(o, idx, &cause) != 0) {
diff --git a/usr.bin/tmux/format.c b/usr.bin/tmux/format.c
index 668a2c80959..db6f4b371ca 100644
--- a/usr.bin/tmux/format.c
+++ b/usr.bin/tmux/format.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: format.c,v 1.267 2020/12/01 08:12:58 nicm Exp $ */
+/* $OpenBSD: format.c,v 1.268 2020/12/15 08:31:50 nicm Exp $ */
/*
* Copyright (c) 2011 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -3085,7 +3085,7 @@ format_defaults_pane(struct format_tree *ft, struct window_pane *wp)
format_add_cb(ft, "pane_in_mode", format_cb_pane_in_mode);
format_add(ft, "pane_synchronized", "%d",
- !!options_get_number(w->options, "synchronize-panes"));
+ !!options_get_number(wp->options, "synchronize-panes"));
if (wp->searchstr != NULL)
format_add(ft, "pane_search_string", "%s", wp->searchstr);
diff --git a/usr.bin/tmux/options-table.c b/usr.bin/tmux/options-table.c
index 560587d048e..1ea2b19aad5 100644
--- a/usr.bin/tmux/options-table.c
+++ b/usr.bin/tmux/options-table.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: options-table.c,v 1.135 2020/12/01 08:12:58 nicm Exp $ */
+/* $OpenBSD: options-table.c,v 1.136 2020/12/15 08:31:50 nicm Exp $ */
/*
* Copyright (c) 2011 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -958,7 +958,7 @@ const struct options_table_entry options_table[] = {
{ .name = "synchronize-panes",
.type = OPTIONS_TABLE_FLAG,
- .scope = OPTIONS_TABLE_WINDOW,
+ .scope = OPTIONS_TABLE_WINDOW|OPTIONS_TABLE_PANE,
.default_num = 0,
.text = "Whether typing should be sent to all panes simultaneously."
},
diff --git a/usr.bin/tmux/tmux.1 b/usr.bin/tmux/tmux.1
index 1bb3503fd0a..e1e735d4c91 100644
--- a/usr.bin/tmux/tmux.1
+++ b/usr.bin/tmux/tmux.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: tmux.1,v 1.807 2020/12/03 07:12:12 nicm Exp $
+.\" $OpenBSD: tmux.1,v 1.808 2020/12/15 08:31:50 nicm Exp $
.\"
.\" Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
.\"
@@ -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: December 3 2020 $
+.Dd $Mdocdate: December 15 2020 $
.Dt TMUX 1
.Os
.Sh NAME
@@ -3136,7 +3136,7 @@ abc123
Commands which set options are as follows:
.Bl -tag -width Ds
.It Xo Ic set-option
-.Op Fl aFgopqsuw
+.Op Fl aFgopqsuUw
.Op Fl t Ar target-pane
.Ar option Ar value
.Xc
@@ -3169,6 +3169,11 @@ flag unsets an option, so a session inherits the option from the global
options (or with
.Fl g ,
restores a global option to the default).
+.Fl U
+unsets an option (like
+.Fl u )
+but if the option is a pane option also unsets the option on any panes in the
+window.
.Ar value
depends on the option and may be a number, a string, or a flag (on, off, or
omitted to toggle).
@@ -4062,12 +4067,6 @@ see the
section.
Attributes are ignored.
.Pp
-.It Xo Ic synchronize-panes
-.Op Ic on | off
-.Xc
-Duplicate input to any pane to all other panes in the same window (only
-for panes that are not in any special mode).
-.Pp
.It Ic window-status-activity-style Ar style
Set status line style for windows with an activity alert.
For how to specify
@@ -4190,6 +4189,12 @@ The pane may be reactivated with the
.Ic respawn-pane
command.
.Pp
+.It Xo Ic synchronize-panes
+.Op Ic on | off
+.Xc
+Duplicate input to all other panes in the same window where this option is also
+on (only for panes that are not in any mode).
+.Pp
.It Ic window-active-style Ar style
Set the pane style when it is the active pane.
For how to specify
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);
}