aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/CONTRIBUTING.md9
-rw-r--r--.github/ISSUE_TEMPLATE.md3
-rw-r--r--.github/README.md19
-rw-r--r--CHANGES53
-rw-r--r--Makefile.am1
-rw-r--r--README6
-rw-r--r--arguments.c22
-rw-r--r--cfg.c10
-rw-r--r--client.c4
-rw-r--r--cmd-attach-session.c27
-rw-r--r--cmd-break-pane.c2
-rw-r--r--cmd-display-message.c3
-rw-r--r--cmd-display-panes.c2
-rw-r--r--cmd-find-window.c81
-rw-r--r--cmd-find.c73
-rw-r--r--cmd-if-shell.c20
-rw-r--r--cmd-join-pane.c2
-rw-r--r--cmd-load-buffer.c2
-rw-r--r--cmd-new-session.c7
-rw-r--r--cmd-parse.y61
-rw-r--r--cmd-queue.c7
-rw-r--r--cmd-refresh-client.c62
-rw-r--r--cmd-resize-pane.c8
-rw-r--r--cmd-run-shell.c2
-rw-r--r--cmd-select-pane.c18
-rw-r--r--cmd-send-keys.c76
-rw-r--r--cmd-set-option.c68
-rw-r--r--cmd-show-options.c132
-rw-r--r--cmd-source-file.c6
-rw-r--r--cmd-swap-pane.c4
-rw-r--r--cmd-wait-for.c8
-rw-r--r--cmd.c4
-rw-r--r--colour.c84
-rw-r--r--configure.ac2
-rw-r--r--control-notify.c3
-rw-r--r--control.c1
-rw-r--r--format-draw.c17
-rw-r--r--format.c133
-rw-r--r--grid-view.c1
-rw-r--r--grid.c35
-rw-r--r--input-keys.c7
-rw-r--r--input.c29
-rw-r--r--job.c2
-rw-r--r--key-string.c6
-rw-r--r--layout-custom.c12
-rw-r--r--layout-set.c8
-rw-r--r--layout.c139
-rw-r--r--menu.c22
-rw-r--r--mode-tree.c6
-rw-r--r--options-table.c12
-rw-r--r--options.c105
-rw-r--r--osdep-netbsd.c17
-rw-r--r--regress/command-order.sh6
-rw-r--r--regress/conf/21867280ff7e99631046f9cc669b80d2.conf8
-rw-r--r--regress/conf/99749670b62bcb99a9b2e3d59708e357.conf93
-rw-r--r--regress/xenl-terminal.sh29
-rw-r--r--regsub.c115
-rw-r--r--screen-redraw.c24
-rw-r--r--screen-write.c8
-rw-r--r--server-client.c99
-rw-r--r--server-fn.c2
-rw-r--r--server.c7
-rw-r--r--spawn.c4
-rw-r--r--style.c14
-rw-r--r--tmux.1513
-rw-r--r--tmux.c6
-rw-r--r--tmux.h64
-rw-r--r--tty-term.c3
-rw-r--r--tty.c140
-rw-r--r--window-buffer.c2
-rw-r--r--window-copy.c15
-rw-r--r--window.c185
-rw-r--r--xmalloc.c2
73 files changed, 1843 insertions, 939 deletions
diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md
index 49e2b90b..3a589484 100644
--- a/.github/CONTRIBUTING.md
+++ b/.github/CONTRIBUTING.md
@@ -2,13 +2,20 @@
Before opening an issue, please ensure that:
+- Your problem is a specific problem or question or suggestion, not a general
+ complaint.
+
- `$TERM` inside tmux is screen, screen-256color, tmux or tmux-256color. Check
by running `echo $TERM` inside tmux.
- You can reproduce the problem with the latest tmux release, or a build from
Git master.
-- Your question or issue is not covered in the manual (run man tmux).
+- Your question or issue is not covered [in the
+ manual](https://man.openbsd.org/tmux.1) (run `man tmux`).
+
+- Your problem is not mentioned in the [CHANGES
+ file](https://raw.githubusercontent.com/tmux/tmux/master/CHANGES) file.
- Nobody else has opened the same issue recently.
diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md
index ee457237..8bf1e66a 100644
--- a/.github/ISSUE_TEMPLATE.md
+++ b/.github/ISSUE_TEMPLATE.md
@@ -3,6 +3,9 @@
Please read https://github.com/tmux/tmux/blob/master/.github/CONTRIBUTING.md
before opening an issue.
+If you have upgraded, make sure your issue is not covered in the CHANGES file
+for your version: https://raw.githubusercontent.com/tmux/tmux/master/CHANGES
+
Describe the problem and the steps to reproduce. Add a minimal tmux config if
necessary. Screenshots can be helpful, but no more than one or two.
diff --git a/.github/README.md b/.github/README.md
index 6e262ef5..2b299cc5 100644
--- a/.github/README.md
+++ b/.github/README.md
@@ -30,7 +30,8 @@ configure with `--enable-utempter` to enable this.
### From version control
-To get and build the latest from version control:
+To get and build the latest from version control - note that this requires
+`autoconf`, `automake` and `pkg-config`:
~~~bash
git clone https://github.com/tmux/tmux.git
@@ -39,10 +40,6 @@ sh autogen.sh
./configure && make
~~~
-(Note that this requires at least a working C compiler, `make`, `autoconf`,
-`automake`, `pkg-config` as well as `libevent` and `ncurses` libraries and
-headers.)
-
## Contributing
Bug reports, feature suggestions and especially code contributions are most
@@ -50,14 +47,12 @@ welcome. Please send by email to:
tmux-users@googlegroups.com
-Or open a GitHub issue or pull request.
-
-There is [a TODO list](https://github.com/tmux/tmux/wiki/Contributing) which
-explains some ideas for tmux not yet developed. Please feel free to ask for
-clarifications on the mailing list if you're thinking of working on these or
-need further information.
+Or open a GitHub issue or pull request. **Please read [this
+document](CONTRIBUTING.md) before opening an issue.**
-Please read the CONTRIBUTING file before opening an issue.
+There is [a list of suggestions for contributions](https://github.com/tmux/tmux/wiki/Contributing).
+Please feel free to ask on the mailing list if you're thinking of working on something or need
+further information.
## Documentation
diff --git a/CHANGES b/CHANGES
index 3563bcbc..952a95a6 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,56 @@
+CHANGES FROM 3.0 to X.X
+
+* Expand arguments to C and s format modifiers to match the m modifier.
+
+* Add support for underscore colours (Setulc capability must be added with
+ terminal-overrides as described in tmux(1)).
+
+* Add a "fill" style attribute for the fill colour of the drawing area (where
+ appropriate).
+
+* New -H flag to send-keys to send literal keys.
+
+* Format variables for pane mouse modes (mouse_utf8_flag and mouse_sgr_flag)
+ and for origin mode (origin_flag).
+
+* Add -F to refresh-client for flags for control mode clients, only one flag
+ (no-output) supported at the moment.
+
+* Add a few vi(1) keys for menus.
+
+* Add pane options, set with set-option -p and displayed with show-options -p.
+ Pane options inherit from window options (so every pane option is also
+ a window option). The pane style is now configured by setting window-style
+ and window-active-style in the pane options; select-pane -P and -g now change
+ the option but are no longer documented.
+
+* Do not document set-window-option and show-window-options. set-option -w and
+ show-options -w should be used instead.
+
+* Add a -A flag to show-options to show parent options as well (they are marked
+ with a *).
+
+* Resize panes lazily - do not resize unless they are in an attached, active
+ window.
+
+* Add regular expression support for the format search, match and substitute
+ modifiers and make them able to ignore case. find-window now accepts -r to
+ use regular expressions.
+
+* Do not use $TMUX to find the session because for windows in multiple sessions
+ it is wrong as often as it is right, and for windows in one session it is
+ pointless. Instead use TMUX_PANE if it is present.
+
+* Do not always resize the window back to its original size after applying a
+ layout, keep it at the layout size until it must be resized (for example when
+ attached and window-size is not manual).
+
+* Add new-session -X and attach-session -x to send SIGHUP to parent when
+ detaching (like detach-client -P).
+
+* Support for octal escapes in strings (such as \007) and improve list-keys
+ output so it parses correctly if copied into a configuration file.
+
CHANGES FROM 2.9 to 3.0
* INCOMPATIBLE: Add a new {} syntax to the configuration file. This is a string
diff --git a/Makefile.am b/Makefile.am
index 2b88892f..94b1564b 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -151,6 +151,7 @@ dist_tmux_SOURCES = \
options.c \
paste.c \
proc.c \
+ regsub.c \
resize.c \
screen-redraw.c \
screen-write.c \
diff --git a/README b/README
index 8a9070b8..4f577060 100644
--- a/README
+++ b/README
@@ -26,16 +26,14 @@ To build and install tmux from a release tarball, use:
tmux can use the utempter library to update utmp(5), if it is installed - run
configure with --enable-utempter to enable this.
-To get and build the latest from version control:
+To get and build the latest from version control - note that this requires
+autoconf, automake and pkg-config:
$ git clone https://github.com/tmux/tmux.git
$ cd tmux
$ sh autogen.sh
$ ./configure && make
-(Note that this requires at least a working C compiler, make, autoconf,
-automake, pkg-config as well as libevent and ncurses libraries and headers.)
-
* Contributing
Bug reports, feature suggestions and especially code contributions are most
diff --git a/arguments.c b/arguments.c
index 38e50829..026272af 100644
--- a/arguments.c
+++ b/arguments.c
@@ -37,6 +37,7 @@ TAILQ_HEAD(args_values, args_value);
struct args_entry {
u_char flag;
struct args_values values;
+ u_int count;
RB_ENTRY(args_entry) entry;
};
@@ -173,6 +174,7 @@ args_print(struct args *args)
size_t len;
char *buf;
int i;
+ u_int j;
struct args_entry *entry;
struct args_value *value;
@@ -186,7 +188,8 @@ args_print(struct args *args)
if (*buf == '\0')
args_print_add(&buf, &len, "-");
- args_print_add(&buf, &len, "%c", entry->flag);
+ for (j = 0; j < entry->count; j++)
+ args_print_add(&buf, &len, "%c", entry->flag);
}
/* Then the flags with arguments. */
@@ -212,12 +215,14 @@ args_escape(const char *s)
if (*s == '\0')
return (xstrdup(s));
- if ((strchr(quoted, s[0]) != NULL || s[0] == '~') && s[1] == '\0') {
+ if (s[0] != ' ' &&
+ (strchr(quoted, s[0]) != NULL || s[0] == '~') &&
+ s[1] == '\0') {
xasprintf(&escaped, "\\%c", s[0]);
return (escaped);
}
- flags = VIS_OCTAL|VIS_TAB|VIS_NL;
+ flags = VIS_OCTAL|VIS_CSTYLE|VIS_TAB|VIS_NL;
if (s[strcspn(s, quoted)] != '\0')
flags |= VIS_DQ;
utf8_stravis(&escaped, s, flags);
@@ -241,7 +246,12 @@ args_escape(const char *s)
int
args_has(struct args *args, u_char ch)
{
- return (args_find(args, ch) != NULL);
+ struct args_entry *entry;
+
+ entry = args_find(args, ch);
+ if (entry == NULL)
+ return (0);
+ return (entry->count);
}
/* Set argument value in the arguments tree. */
@@ -255,9 +265,11 @@ args_set(struct args *args, u_char ch, const char *s)
if (entry == NULL) {
entry = xcalloc(1, sizeof *entry);
entry->flag = ch;
+ entry->count = 1;
TAILQ_INIT(&entry->values);
RB_INSERT(args_tree, &args->tree, entry);
- }
+ } else
+ entry->count++;
if (s != NULL) {
value = xcalloc(1, sizeof *value);
diff --git a/cfg.c b/cfg.c
index 18386b56..c29292b2 100644
--- a/cfg.c
+++ b/cfg.c
@@ -52,7 +52,7 @@ cfg_done(__unused struct cmdq_item *item, __unused void *data)
cfg_show_causes(RB_MIN(sessions, &sessions));
if (cfg_item != NULL)
- cfg_item->flags &= ~CMDQ_WAITING;
+ cmdq_continue(cfg_item);
status_prompt_load_history();
@@ -90,14 +90,14 @@ start_cfg(void)
}
if (cfg_file == NULL)
- load_cfg(TMUX_CONF, NULL, NULL, CMD_PARSE_QUIET, NULL);
+ load_cfg(TMUX_CONF, c, NULL, CMD_PARSE_QUIET, NULL);
if (cfg_file == NULL && (home = find_home()) != NULL) {
xasprintf(&cfg_file, "%s/.tmux.conf", home);
flags = CMD_PARSE_QUIET;
}
if (cfg_file != NULL)
- load_cfg(cfg_file, NULL, NULL, flags, NULL);
+ load_cfg(cfg_file, c, NULL, flags, NULL);
cmdq_append(NULL, cmdq_get_callback(cfg_done, NULL));
}
@@ -126,6 +126,8 @@ load_cfg(const char *path, struct client *c, struct cmdq_item *item, int flags,
pi.flags = flags;
pi.file = path;
pi.line = 1;
+ pi.item = item;
+ pi.c = c;
pr = cmd_parse_from_file(f, &pi);
fclose(f);
@@ -145,7 +147,7 @@ load_cfg(const char *path, struct client *c, struct cmdq_item *item, int flags,
if (item != NULL)
cmdq_insert_after(item, new_item0);
else
- cmdq_append(c, new_item0);
+ cmdq_append(NULL, new_item0);
cmd_list_free(pr->cmdlist);
if (new_item != NULL)
diff --git a/client.c b/client.c
index d137501a..204a431b 100644
--- a/client.c
+++ b/client.c
@@ -202,7 +202,7 @@ client_exit_message(void)
case CLIENT_EXIT_TERMINATED:
return ("terminated");
case CLIENT_EXIT_LOST_SERVER:
- return ("lost server");
+ return ("server exited unexpectedly");
case CLIENT_EXIT_EXITED:
return ("exited");
case CLIENT_EXIT_SERVER_EXITED:
@@ -436,7 +436,7 @@ client_stdin_callback(__unused int fd, __unused short events,
struct msg_stdin_data data;
data.size = read(STDIN_FILENO, data.data, sizeof data.data);
- if (data.size < 0 && (errno == EINTR || errno == EAGAIN))
+ if (data.size == -1 && (errno == EINTR || errno == EAGAIN))
return;
proc_send(client_peer, MSG_STDIN, -1, &data, sizeof data);
diff --git a/cmd-attach-session.c b/cmd-attach-session.c
index bcd6d895..6de734e5 100644
--- a/cmd-attach-session.c
+++ b/cmd-attach-session.c
@@ -37,8 +37,8 @@ const struct cmd_entry cmd_attach_session_entry = {
.name = "attach-session",
.alias = "attach",
- .args = { "c:dErt:", 0, 0 },
- .usage = "[-dEr] [-c working-directory] " CMD_TARGET_SESSION_USAGE,
+ .args = { "c:dErt:x", 0, 0 },
+ .usage = "[-dErx] [-c working-directory] " CMD_TARGET_SESSION_USAGE,
/* -t is special */
@@ -48,7 +48,7 @@ const struct cmd_entry cmd_attach_session_entry = {
enum cmd_retval
cmd_attach_session(struct cmdq_item *item, const char *tflag, int dflag,
- int rflag, const char *cflag, int Eflag)
+ int xflag, int rflag, const char *cflag, int Eflag)
{
struct cmd_find_state *current = &item->shared->current;
enum cmd_find_type type;
@@ -58,6 +58,7 @@ cmd_attach_session(struct cmdq_item *item, const char *tflag, int dflag,
struct winlink *wl;
struct window_pane *wp;
char *cause;
+ enum msgtype msgtype;
if (RB_EMPTY(&sessions)) {
cmdq_error(item, "no sessions");
@@ -102,11 +103,15 @@ cmd_attach_session(struct cmdq_item *item, const char *tflag, int dflag,
c->last_session = c->session;
if (c->session != NULL) {
- if (dflag) {
+ if (dflag || xflag) {
+ if (xflag)
+ msgtype = MSG_DETACHKILL;
+ else
+ msgtype = MSG_DETACH;
TAILQ_FOREACH(c_loop, &clients, entry) {
if (c_loop->session != s || c == c_loop)
continue;
- server_client_detach(c_loop, MSG_DETACH);
+ server_client_detach(c_loop, msgtype);
}
}
if (!Eflag)
@@ -131,11 +136,15 @@ cmd_attach_session(struct cmdq_item *item, const char *tflag, int dflag,
if (rflag)
c->flags |= CLIENT_READONLY;
- if (dflag) {
+ if (dflag || xflag) {
+ if (xflag)
+ msgtype = MSG_DETACHKILL;
+ else
+ msgtype = MSG_DETACH;
TAILQ_FOREACH(c_loop, &clients, entry) {
if (c_loop->session != s || c == c_loop)
continue;
- server_client_detach(c_loop, MSG_DETACH);
+ server_client_detach(c_loop, msgtype);
}
}
if (!Eflag)
@@ -169,6 +178,6 @@ cmd_attach_session_exec(struct cmd *self, struct cmdq_item *item)
struct args *args = self->args;
return (cmd_attach_session(item, args_get(args, 't'),
- args_has(args, 'd'), args_has(args, 'r'), args_get(args, 'c'),
- args_has(args, 'E')));
+ args_has(args, 'd'), args_has(args, 'x'), args_has(args, 'r'),
+ args_get(args, 'c'), args_has(args, 'E')));
}
diff --git a/cmd-break-pane.c b/cmd-break-pane.c
index 3b929dee..b4c5b7cd 100644
--- a/cmd-break-pane.c
+++ b/cmd-break-pane.c
@@ -77,6 +77,8 @@ cmd_break_pane_exec(struct cmd *self, struct cmdq_item *item)
layout_close_pane(wp);
w = wp->window = window_create(w->sx, w->sy);
+ options_set_parent(wp->options, w->options);
+ wp->flags |= PANE_STYLECHANGED;
TAILQ_INSERT_HEAD(&w->panes, wp, entry);
w->active = wp;
diff --git a/cmd-display-message.c b/cmd-display-message.c
index 8c1ad5f6..4d9bccb6 100644
--- a/cmd-display-message.c
+++ b/cmd-display-message.c
@@ -109,8 +109,7 @@ cmd_display_message_exec(struct cmd *self, struct cmdq_item *item)
format_defaults(ft, target_c, s, wl, wp);
if (args_has(args, 'a')) {
- if (item != NULL)
- format_each(ft, cmd_display_message_each, item);
+ format_each(ft, cmd_display_message_each, item);
return (CMD_RETURN_NORMAL);
}
diff --git a/cmd-display-panes.c b/cmd-display-panes.c
index 7f38cd9e..df97819c 100644
--- a/cmd-display-panes.c
+++ b/cmd-display-panes.c
@@ -188,7 +188,7 @@ cmd_display_panes_free(struct client *c)
struct cmd_display_panes_data *cdata = c->overlay_data;
if (cdata->item != NULL)
- cdata->item->flags &= ~CMDQ_WAITING;
+ cmdq_continue(cdata->item);
free(cdata->command);
free(cdata);
}
diff --git a/cmd-find-window.c b/cmd-find-window.c
index c2d230a5..c29878b5 100644
--- a/cmd-find-window.c
+++ b/cmd-find-window.c
@@ -32,8 +32,8 @@ const struct cmd_entry cmd_find_window_entry = {
.name = "find-window",
.alias = "findw",
- .args = { "CNt:TZ", 1, 1 },
- .usage = "[-CNTZ] " CMD_TARGET_PANE_USAGE " match-string",
+ .args = { "CNrt:TZ", 1, 1 },
+ .usage = "[-CNrTZ] " CMD_TARGET_PANE_USAGE " match-string",
.target = { 't', CMD_FIND_PANE, 0 },
@@ -57,30 +57,59 @@ cmd_find_window_exec(struct cmd *self, struct cmdq_item *item)
if (!C && !N && !T)
C = N = T = 1;
- if (C && N && T) {
- xasprintf(&filter,
- "#{||:"
- "#{C:%s},#{||:#{m:*%s*,#{window_name}},"
- "#{m:*%s*,#{pane_title}}}}",
- s, s, s);
- } else if (C && N) {
- xasprintf(&filter,
- "#{||:#{C:%s},#{m:*%s*,#{window_name}}}",
- s, s);
- } else if (C && T) {
- xasprintf(&filter,
- "#{||:#{C:%s},#{m:*%s*,#{pane_title}}}",
- s, s);
- } else if (N && T) {
- xasprintf(&filter,
- "#{||:#{m:*%s*,#{window_name}},#{m:*%s*,#{pane_title}}}",
- s, s);
- } else if (C)
- xasprintf(&filter, "#{C:%s}", s);
- else if (N)
- xasprintf(&filter, "#{m:*%s*,#{window_name}}", s);
- else
- xasprintf(&filter, "#{m:*%s*,#{pane_title}}", s);
+ if (!args_has(args, 'r')) {
+ if (C && N && T) {
+ xasprintf(&filter,
+ "#{||:"
+ "#{C:%s},#{||:#{m:*%s*,#{window_name}},"
+ "#{m:*%s*,#{pane_title}}}}",
+ s, s, s);
+ } else if (C && N) {
+ xasprintf(&filter,
+ "#{||:#{C:%s},#{m:*%s*,#{window_name}}}",
+ s, s);
+ } else if (C && T) {
+ xasprintf(&filter,
+ "#{||:#{C:%s},#{m:*%s*,#{pane_title}}}",
+ s, s);
+ } else if (N && T) {
+ xasprintf(&filter,
+ "#{||:#{m:*%s*,#{window_name}},"
+ "#{m:*%s*,#{pane_title}}}",
+ s, s);
+ } else if (C)
+ xasprintf(&filter, "#{C:%s}", s);
+ else if (N)
+ xasprintf(&filter, "#{m:*%s*,#{window_name}}", s);
+ else
+ xasprintf(&filter, "#{m:*%s*,#{pane_title}}", s);
+ } else {
+ if (C && N && T) {
+ xasprintf(&filter,
+ "#{||:"
+ "#{C/r:%s},#{||:#{m/r:%s,#{window_name}},"
+ "#{m/r:%s,#{pane_title}}}}",
+ s, s, s);
+ } else if (C && N) {
+ xasprintf(&filter,
+ "#{||:#{C/r:%s},#{m/r:%s,#{window_name}}}",
+ s, s);
+ } else if (C && T) {
+ xasprintf(&filter,
+ "#{||:#{C/r:%s},#{m/r:%s,#{pane_title}}}",
+ s, s);
+ } else if (N && T) {
+ xasprintf(&filter,
+ "#{||:#{m/r:%s,#{window_name}},"
+ "#{m/r:%s,#{pane_title}}}",
+ s, s);
+ } else if (C)
+ xasprintf(&filter, "#{C/r:%s}", s);
+ else if (N)
+ xasprintf(&filter, "#{m/r:%s,#{window_name}}", s);
+ else
+ xasprintf(&filter, "#{m/r:%s,#{pane_title}}", s);
+ }
new_args = args_parse("", 1, &argv);
if (args_has(args, 'Z'))
diff --git a/cmd-find.c b/cmd-find.c
index 7ad8ad7a..154842ab 100644
--- a/cmd-find.c
+++ b/cmd-find.c
@@ -75,38 +75,12 @@ static const char *cmd_find_pane_table[][2] = {
{ NULL, NULL }
};
-/* Get session from TMUX if present. */
-static struct session *
-cmd_find_try_TMUX(struct client *c)
-{
- struct environ_entry *envent;
- char tmp[256];
- long long pid;
- u_int session;
- struct session *s;
-
- envent = environ_find(c->environ, "TMUX");
- if (envent == NULL)
- return (NULL);
-
- if (sscanf(envent->value, "%255[^,],%lld,%d", tmp, &pid, &session) != 3)
- return (NULL);
- if (pid != getpid())
- return (NULL);
- log_debug("%s: client %p TMUX %s (session $%u)", __func__, c,
- envent->value, session);
-
- s = session_find_by_id(session);
- if (s != NULL)