|
|
|
|
@ -1,7 +1,7 @@
|
|
|
|
|
Index: Makefile.in
|
|
|
|
|
--- Makefile.in.orig 2013-03-26 21:21:41.000000000 +0100
|
|
|
|
|
+++ Makefile.in 2013-03-27 14:35:06.995151825 +0100
|
|
|
|
|
@@ -73,9 +73,9 @@
|
|
|
|
|
--- Makefile.in.orig 2014-02-22 21:56:13.000000000 +0100
|
|
|
|
|
+++ Makefile.in 2015-02-06 19:30:27.904082307 +0100
|
|
|
|
|
@@ -101,9 +101,9 @@
|
|
|
|
|
@IS_DEBUG_TRUE@@IS_GCC_TRUE@ -Wdeclaration-after-statement
|
|
|
|
|
@IS_DEBUG_TRUE@@IS_GCC_TRUE@am__append_4 = -DDEBUG
|
|
|
|
|
@IS_DEBUG_FALSE@@IS_GCC_TRUE@am__append_5 = -O2
|
|
|
|
|
@ -12,13 +12,13 @@ Index: Makefile.in
|
|
|
|
|
+@IS_GCC4_FALSE@@IS_GCC_TRUE@am__append_8 = -I. -I-
|
|
|
|
|
|
|
|
|
|
# Set flags for Solaris.
|
|
|
|
|
@IS_SUNOS_TRUE@am__append_9 = -D_XPG4_2 -D__EXTENSIONS__ -D_POSIX_PTHREAD_SEMANTICS
|
|
|
|
|
@IS_GCC_TRUE@@IS_SUNOS_TRUE@am__append_9 = -D_XPG6 -D__EXTENSIONS__ -D_POSIX_PTHREAD_SEMANTICS
|
|
|
|
|
Index: arguments.c
|
|
|
|
|
--- arguments.c.orig 2013-02-10 17:20:15.000000000 +0100
|
|
|
|
|
+++ arguments.c 2013-03-27 14:31:38.944675563 +0100
|
|
|
|
|
@@ -61,7 +61,9 @@
|
|
|
|
|
if ((args->flags = bit_alloc(SCHAR_MAX)) == NULL)
|
|
|
|
|
fatal("bit_alloc failed");
|
|
|
|
|
--- arguments.c.orig 2014-02-22 21:48:37.000000000 +0100
|
|
|
|
|
+++ arguments.c 2015-02-06 19:30:27.904082307 +0100
|
|
|
|
|
@@ -82,7 +82,9 @@
|
|
|
|
|
|
|
|
|
|
args = xcalloc(1, sizeof *args);
|
|
|
|
|
|
|
|
|
|
+#ifdef __Linux__
|
|
|
|
|
optreset = 1;
|
|
|
|
|
@ -26,3 +26,599 @@ Index: arguments.c
|
|
|
|
|
optind = 1;
|
|
|
|
|
|
|
|
|
|
while ((opt = getopt(argc, argv, template)) != -1) {
|
|
|
|
|
@@ -125,7 +127,7 @@
|
|
|
|
|
size_t
|
|
|
|
|
args_print(struct args *args, char *buf, size_t len)
|
|
|
|
|
{
|
|
|
|
|
- size_t off;
|
|
|
|
|
+ size_t off, used;
|
|
|
|
|
int i;
|
|
|
|
|
const char *quotes;
|
|
|
|
|
struct args_entry *entry;
|
|
|
|
|
@@ -165,9 +167,12 @@
|
|
|
|
|
quotes = "\"";
|
|
|
|
|
else
|
|
|
|
|
quotes = "";
|
|
|
|
|
- off += xsnprintf(buf + off, len - off, "%s-%c %s%s%s",
|
|
|
|
|
+ used = xsnprintf(buf + off, len - off, "%s-%c %s%s%s",
|
|
|
|
|
off != 0 ? " " : "", entry->flag, quotes, entry->value,
|
|
|
|
|
quotes);
|
|
|
|
|
+ if (used > len - off)
|
|
|
|
|
+ used = len - off;
|
|
|
|
|
+ off += used;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* And finally the argument vector. */
|
|
|
|
|
@@ -181,8 +186,11 @@
|
|
|
|
|
quotes = "\"";
|
|
|
|
|
else
|
|
|
|
|
quotes = "";
|
|
|
|
|
- off += xsnprintf(buf + off, len - off, "%s%s%s%s",
|
|
|
|
|
+ used = xsnprintf(buf + off, len - off, "%s%s%s%s",
|
|
|
|
|
off != 0 ? " " : "", quotes, args->argv[i], quotes);
|
|
|
|
|
+ if (used > len - off)
|
|
|
|
|
+ used = len - off;
|
|
|
|
|
+ off += used;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (off);
|
|
|
|
|
Index: client.c
|
|
|
|
|
--- client.c.orig 2014-02-22 21:48:37.000000000 +0100
|
|
|
|
|
+++ client.c 2015-02-06 19:30:31.615416988 +0100
|
|
|
|
|
@@ -78,13 +78,18 @@
|
|
|
|
|
|
|
|
|
|
if ((lockfd = open(lockfile, O_WRONLY|O_CREAT, 0600)) == -1)
|
|
|
|
|
fatal("open failed");
|
|
|
|
|
+ log_debug("lock file is %s", lockfile);
|
|
|
|
|
|
|
|
|
|
- if (lockf(lockfd, F_TLOCK, 0) == -1 && errno == EAGAIN) {
|
|
|
|
|
- while (lockf(lockfd, F_LOCK, 0) == -1 && errno == EINTR)
|
|
|
|
|
+ if (flock(lockfd, LOCK_EX|LOCK_NB) == -1) {
|
|
|
|
|
+ log_debug("flock failed: %s", strerror(errno));
|
|
|
|
|
+ if (errno != EAGAIN)
|
|
|
|
|
+ return (lockfd);
|
|
|
|
|
+ while (flock(lockfd, LOCK_EX) == -1 && errno == EINTR)
|
|
|
|
|
/* nothing */;
|
|
|
|
|
close(lockfd);
|
|
|
|
|
return (-1);
|
|
|
|
|
}
|
|
|
|
|
+ log_debug("flock succeeded");
|
|
|
|
|
|
|
|
|
|
return (lockfd);
|
|
|
|
|
}
|
|
|
|
|
@@ -95,8 +100,8 @@
|
|
|
|
|
{
|
|
|
|
|
struct sockaddr_un sa;
|
|
|
|
|
size_t size;
|
|
|
|
|
- int fd, lockfd;
|
|
|
|
|
- char *lockfile;
|
|
|
|
|
+ int fd, lockfd = -1, locked = 0;
|
|
|
|
|
+ char *lockfile = NULL;
|
|
|
|
|
|
|
|
|
|
memset(&sa, 0, sizeof sa);
|
|
|
|
|
sa.sun_family = AF_UNIX;
|
|
|
|
|
@@ -105,29 +110,48 @@
|
|
|
|
|
errno = ENAMETOOLONG;
|
|
|
|
|
return (-1);
|
|
|
|
|
}
|
|
|
|
|
+ log_debug("socket is %s", path);
|
|
|
|
|
|
|
|
|
|
retry:
|
|
|
|
|
if ((fd = socket(AF_UNIX, SOCK_STREAM, 0)) == -1)
|
|
|
|
|
fatal("socket failed");
|
|
|
|
|
|
|
|
|
|
+ log_debug("trying connect");
|
|
|
|
|
if (connect(fd, (struct sockaddr *) &sa, SUN_LEN(&sa)) == -1) {
|
|
|
|
|
+ log_debug("connect failed: %s", strerror(errno));
|
|
|
|
|
if (errno != ECONNREFUSED && errno != ENOENT)
|
|
|
|
|
goto failed;
|
|
|
|
|
if (!start_server)
|
|
|
|
|
goto failed;
|
|
|
|
|
close(fd);
|
|
|
|
|
|
|
|
|
|
- xasprintf(&lockfile, "%s.lock", path);
|
|
|
|
|
- if ((lockfd = client_get_lock(lockfile)) == -1) {
|
|
|
|
|
- free(lockfile);
|
|
|
|
|
+ if (!locked) {
|
|
|
|
|
+ xasprintf(&lockfile, "%s.lock", path);
|
|
|
|
|
+ if ((lockfd = client_get_lock(lockfile)) == -1) {
|
|
|
|
|
+ log_debug("didn't get lock");
|
|
|
|
|
+ free(lockfile);
|
|
|
|
|
+ goto retry;
|
|
|
|
|
+ }
|
|
|
|
|
+ log_debug("got lock");
|
|
|
|
|
+
|
|
|
|
|
+ /*
|
|
|
|
|
+ * Always retry at least once, even if we got the lock,
|
|
|
|
|
+ * because another client could have taken the lock,
|
|
|
|
|
+ * started the server and released the lock between our
|
|
|
|
|
+ * connect() and flock().
|
|
|
|
|
+ */
|
|
|
|
|
+ locked = 1;
|
|
|
|
|
goto retry;
|
|
|
|
|
}
|
|
|
|
|
+
|
|
|
|
|
if (unlink(path) != 0 && errno != ENOENT) {
|
|
|
|
|
free(lockfile);
|
|
|
|
|
close(lockfd);
|
|
|
|
|
return (-1);
|
|
|
|
|
}
|
|
|
|
|
fd = server_start(lockfd, lockfile);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (locked) {
|
|
|
|
|
free(lockfile);
|
|
|
|
|
close(lockfd);
|
|
|
|
|
}
|
|
|
|
|
@@ -234,7 +258,13 @@
|
|
|
|
|
return (1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- /* Initialise the client socket and start the server. */
|
|
|
|
|
+ /* Set process title, log and signals now this is the client. */
|
|
|
|
|
+#ifdef HAVE_SETPROCTITLE
|
|
|
|
|
+ setproctitle("client (%s)", socket_path);
|
|
|
|
|
+#endif
|
|
|
|
|
+ logfile("client");
|
|
|
|
|
+
|
|
|
|
|
+ /* Initialize the client socket and start the server. */
|
|
|
|
|
fd = client_connect(socket_path, cmdflags & CMD_STARTSERVER);
|
|
|
|
|
if (fd == -1) {
|
|
|
|
|
fprintf(stderr, "failed to connect to server: %s\n",
|
|
|
|
|
@@ -242,12 +272,6 @@
|
|
|
|
|
return (1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- /* Set process title, log and signals now this is the client. */
|
|
|
|
|
-#ifdef HAVE_SETPROCTITLE
|
|
|
|
|
- setproctitle("client (%s)", socket_path);
|
|
|
|
|
-#endif
|
|
|
|
|
- logfile("client");
|
|
|
|
|
-
|
|
|
|
|
/* Create imsg. */
|
|
|
|
|
imsg_init(&client_ibuf, fd);
|
|
|
|
|
event_set(&client_event, fd, EV_READ, client_callback, shell_cmd);
|
|
|
|
|
Index: cmd-find-window.c
|
|
|
|
|
--- cmd-find-window.c.orig 2014-02-22 21:48:37.000000000 +0100
|
|
|
|
|
+++ cmd-find-window.c 2015-02-06 19:30:27.915288829 +0100
|
|
|
|
|
@@ -199,6 +199,8 @@
|
|
|
|
|
window_choose_ready(wl->window->active, 0, cmd_find_window_callback);
|
|
|
|
|
|
|
|
|
|
out:
|
|
|
|
|
+ for (i = 0; i < ARRAY_LENGTH(&find_list); i++)
|
|
|
|
|
+ free(ARRAY_ITEM(&find_list, i).list_ctx);
|
|
|
|
|
ARRAY_FREE(&find_list);
|
|
|
|
|
return (CMD_RETURN_NORMAL);
|
|
|
|
|
}
|
|
|
|
|
Index: cmd-list.c
|
|
|
|
|
--- cmd-list.c.orig 2014-02-22 21:48:37.000000000 +0100
|
|
|
|
|
+++ cmd-list.c 2015-02-06 19:30:27.904082307 +0100
|
|
|
|
|
@@ -103,7 +103,7 @@
|
|
|
|
|
cmd_list_print(struct cmd_list *cmdlist, char *buf, size_t len)
|
|
|
|
|
{
|
|
|
|
|
struct cmd *cmd;
|
|
|
|
|
- size_t off;
|
|
|
|
|
+ size_t off, used;
|
|
|
|
|
|
|
|
|
|
off = 0;
|
|
|
|
|
TAILQ_FOREACH(cmd, &cmdlist->list, qentry) {
|
|
|
|
|
@@ -112,8 +112,12 @@
|
|
|
|
|
off += cmd_print(cmd, buf + off, len - off);
|
|
|
|
|
if (off >= len)
|
|
|
|
|
break;
|
|
|
|
|
- if (TAILQ_NEXT(cmd, qentry) != NULL)
|
|
|
|
|
- off += xsnprintf(buf + off, len - off, " ; ");
|
|
|
|
|
+ if (TAILQ_NEXT(cmd, qentry) != NULL) {
|
|
|
|
|
+ used = xsnprintf(buf + off, len - off, " ; ");
|
|
|
|
|
+ if (used > len - off)
|
|
|
|
|
+ used = len - off;
|
|
|
|
|
+ off += used;
|
|
|
|
|
+ }
|
|
|
|
|
}
|
|
|
|
|
return (off);
|
|
|
|
|
}
|
|
|
|
|
Index: cmd-save-buffer.c
|
|
|
|
|
--- cmd-save-buffer.c.orig 2014-02-22 21:48:37.000000000 +0100
|
|
|
|
|
+++ cmd-save-buffer.c 2015-02-06 19:30:31.615416988 +0100
|
|
|
|
|
@@ -111,7 +111,7 @@
|
|
|
|
|
if (fd != -1)
|
|
|
|
|
f = fdopen(fd, "ab");
|
|
|
|
|
} else {
|
|
|
|
|
- fd = openat(cwd, path, O_CREAT|O_RDWR, 0600);
|
|
|
|
|
+ fd = openat(cwd, path, O_CREAT|O_RDWR|O_TRUNC, 0600);
|
|
|
|
|
if (fd != -1)
|
|
|
|
|
f = fdopen(fd, "wb");
|
|
|
|
|
}
|
|
|
|
|
Index: cmd.c
|
|
|
|
|
--- cmd.c.orig 2014-02-22 21:48:37.000000000 +0100
|
|
|
|
|
+++ cmd.c 2015-02-06 19:30:27.915288829 +0100
|
|
|
|
|
@@ -138,6 +138,9 @@
|
|
|
|
|
size_t arglen;
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
+ if (argc == 0)
|
|
|
|
|
+ return (0);
|
|
|
|
|
+
|
|
|
|
|
*buf = '\0';
|
|
|
|
|
for (i = 0; i < argc; i++) {
|
|
|
|
|
if (strlcpy(buf, argv[i], len) >= len)
|
|
|
|
|
Index: compat.h
|
|
|
|
|
--- compat.h.orig 2014-02-22 21:48:37.000000000 +0100
|
|
|
|
|
+++ compat.h 2015-02-06 19:30:27.904082307 +0100
|
|
|
|
|
@@ -176,6 +176,22 @@
|
|
|
|
|
#define TTY_NAME_MAX 32
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
+#ifndef MAXPATHLEN
|
|
|
|
|
+#define MAXPATHLEN 4096
|
|
|
|
|
+#endif
|
|
|
|
|
+
|
|
|
|
|
+#ifndef PATH_MAX
|
|
|
|
|
+#define PATH_MAX 4096
|
|
|
|
|
+#endif
|
|
|
|
|
+
|
|
|
|
|
+#ifndef MAXHOSTNAMELEN
|
|
|
|
|
+#define MAXHOSTNAMELEN 64
|
|
|
|
|
+#endif
|
|
|
|
|
+
|
|
|
|
|
+#ifndef IOV_MAX
|
|
|
|
|
+#define IOV_MAX 1024
|
|
|
|
|
+#endif
|
|
|
|
|
+
|
|
|
|
|
#ifndef HAVE_BZERO
|
|
|
|
|
#undef bzero
|
|
|
|
|
#define bzero(buf, len) memset(buf, 0, len);
|
|
|
|
|
Index: job.c
|
|
|
|
|
--- job.c.orig 2014-02-22 21:48:37.000000000 +0100
|
|
|
|
|
+++ job.c 2015-02-06 19:30:31.615416988 +0100
|
|
|
|
|
@@ -59,6 +59,8 @@
|
|
|
|
|
switch (pid = fork()) {
|
|
|
|
|
case -1:
|
|
|
|
|
environ_free(&env);
|
|
|
|
|
+ close(out[0]);
|
|
|
|
|
+ close(out[1]);
|
|
|
|
|
return (NULL);
|
|
|
|
|
case 0: /* child */
|
|
|
|
|
clear_signals(1);
|
|
|
|
|
Index: osdep-freebsd.c
|
|
|
|
|
--- osdep-freebsd.c.orig 2014-02-22 21:48:37.000000000 +0100
|
|
|
|
|
+++ osdep-freebsd.c 2015-02-06 19:30:27.904082307 +0100
|
|
|
|
|
@@ -29,7 +29,9 @@
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
#include <string.h>
|
|
|
|
|
#include <unistd.h>
|
|
|
|
|
+#if 0
|
|
|
|
|
#include <libutil.h>
|
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
|
|
struct kinfo_proc *cmp_procs(struct kinfo_proc *, struct kinfo_proc *);
|
|
|
|
|
char *osdep_get_name(int, char *);
|
|
|
|
|
@@ -135,6 +137,7 @@
|
|
|
|
|
char *
|
|
|
|
|
osdep_get_cwd(int fd)
|
|
|
|
|
{
|
|
|
|
|
+#if 0
|
|
|
|
|
static char wd[PATH_MAX];
|
|
|
|
|
struct kinfo_file *info = NULL;
|
|
|
|
|
pid_t pgrp;
|
|
|
|
|
@@ -155,6 +158,7 @@
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
free(info);
|
|
|
|
|
+#endif
|
|
|
|
|
return (NULL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Index: osdep-linux.c
|
|
|
|
|
--- osdep-linux.c.orig 2014-02-22 21:48:37.000000000 +0100
|
|
|
|
|
+++ osdep-linux.c 2015-02-06 19:30:27.915288829 +0100
|
|
|
|
|
@@ -65,7 +65,7 @@
|
|
|
|
|
{
|
|
|
|
|
static char target[MAXPATHLEN + 1];
|
|
|
|
|
char *path;
|
|
|
|
|
- pid_t pgrp;
|
|
|
|
|
+ pid_t pgrp, sid;
|
|
|
|
|
ssize_t n;
|
|
|
|
|
|
|
|
|
|
if ((pgrp = tcgetpgrp(fd)) == -1)
|
|
|
|
|
@@ -74,6 +74,13 @@
|
|
|
|
|
xasprintf(&path, "/proc/%lld/cwd", (long long) pgrp);
|
|
|
|
|
n = readlink(path, target, MAXPATHLEN);
|
|
|
|
|
free(path);
|
|
|
|
|
+
|
|
|
|
|
+ if (n == -1 && ioctl(fd, TIOCGSID, &sid) != -1) {
|
|
|
|
|
+ xasprintf(&path, "/proc/%lld/cwd", (long long) sid);
|
|
|
|
|
+ n = readlink(path, target, MAXPATHLEN);
|
|
|
|
|
+ free(path);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
if (n > 0) {
|
|
|
|
|
target[n] = '\0';
|
|
|
|
|
return (target);
|
|
|
|
|
Index: server-client.c
|
|
|
|
|
--- server-client.c.orig 2014-02-22 21:48:37.000000000 +0100
|
|
|
|
|
+++ server-client.c 2015-02-06 19:30:32.213698752 +0100
|
|
|
|
|
@@ -873,6 +873,9 @@
|
|
|
|
|
break;
|
|
|
|
|
c->flags &= ~CLIENT_SUSPENDED;
|
|
|
|
|
|
|
|
|
|
+ if (c->tty.fd == -1) /* exited in the meantime */
|
|
|
|
|
+ break;
|
|
|
|
|
+
|
|
|
|
|
if (gettimeofday(&c->activity_time, NULL) != 0)
|
|
|
|
|
fatal("gettimeofday");
|
|
|
|
|
if (c->session != NULL)
|
|
|
|
|
Index: server.c
|
|
|
|
|
--- server.c.orig 2014-02-22 21:48:37.000000000 +0100
|
|
|
|
|
+++ server.c 2015-02-06 19:30:31.625739529 +0100
|
|
|
|
|
@@ -112,6 +112,7 @@
|
|
|
|
|
/* The first client is special and gets a socketpair; create it. */
|
|
|
|
|
if (socketpair(AF_UNIX, SOCK_STREAM, PF_UNSPEC, pair) != 0)
|
|
|
|
|
fatal("socketpair failed");
|
|
|
|
|
+ log_debug("starting server");
|
|
|
|
|
|
|
|
|
|
switch (fork()) {
|
|
|
|
|
case -1:
|
|
|
|
|
Index: status.c
|
|
|
|
|
--- status.c.orig 2014-02-22 21:48:37.000000000 +0100
|
|
|
|
|
+++ status.c 2015-02-06 19:30:31.615416988 +0100
|
|
|
|
|
@@ -396,9 +396,6 @@
|
|
|
|
|
case '{':
|
|
|
|
|
ptr = (char *) "#{";
|
|
|
|
|
goto do_replace;
|
|
|
|
|
- case '#':
|
|
|
|
|
- *(*optr)++ = '#';
|
|
|
|
|
- break;
|
|
|
|
|
default:
|
|
|
|
|
xsnprintf(tmp, sizeof tmp, "#%c", *(*iptr - 1));
|
|
|
|
|
ptr = tmp;
|
|
|
|
|
Index: tmux.1
|
|
|
|
|
--- tmux.1.orig 2014-02-22 21:48:37.000000000 +0100
|
|
|
|
|
+++ tmux.1 2015-02-06 19:30:27.904082307 +0100
|
|
|
|
|
@@ -465,7 +465,7 @@
|
|
|
|
|
.Ql -
|
|
|
|
|
may be followed by an offset, for example:
|
|
|
|
|
.Bd -literal -offset indent
|
|
|
|
|
-select-window -t:+2
|
|
|
|
|
+select-window \-t:+2
|
|
|
|
|
.Ed
|
|
|
|
|
.Pp
|
|
|
|
|
When dealing with a session that doesn't contain sequential window indexes,
|
|
|
|
|
@@ -521,13 +521,13 @@
|
|
|
|
|
.Nm
|
|
|
|
|
commands include:
|
|
|
|
|
.Bd -literal -offset indent
|
|
|
|
|
-refresh-client -t/dev/ttyp2
|
|
|
|
|
+refresh-client \-t/dev/ttyp2
|
|
|
|
|
|
|
|
|
|
-rename-session -tfirst newname
|
|
|
|
|
+rename-session \-tfirst newname
|
|
|
|
|
|
|
|
|
|
-set-window-option -t:0 monitor-activity on
|
|
|
|
|
+set-window-option \-t:0 monitor-activity on
|
|
|
|
|
|
|
|
|
|
-new-window ; split-window -d
|
|
|
|
|
+new-window ; split-window \-d
|
|
|
|
|
|
|
|
|
|
bind-key R source-file ~/.tmux.conf \e; \e
|
|
|
|
|
display-message "source-file done"
|
|
|
|
|
@@ -536,11 +536,11 @@
|
|
|
|
|
Or from
|
|
|
|
|
.Xr sh 1 :
|
|
|
|
|
.Bd -literal -offset indent
|
|
|
|
|
-$ tmux kill-window -t :1
|
|
|
|
|
+$ tmux kill-window \-t :1
|
|
|
|
|
|
|
|
|
|
-$ tmux new-window \e; split-window -d
|
|
|
|
|
+$ tmux new-window \e; split-window \-d
|
|
|
|
|
|
|
|
|
|
-$ tmux new-session -d 'vi /etc/passwd' \e; split-window -d \e; attach
|
|
|
|
|
+$ tmux new-session \-d 'vi /etc/passwd' \e; split-window \-d \e; attach
|
|
|
|
|
.Ed
|
|
|
|
|
.Sh CLIENTS AND SESSIONS
|
|
|
|
|
The
|
|
|
|
|
@@ -970,7 +970,7 @@
|
|
|
|
|
.Pa /tmp
|
|
|
|
|
as well as the paste buffer:
|
|
|
|
|
.Bd -literal -offset indent
|
|
|
|
|
-bind-key -temacs-copy C-q copy-pipe "cat >/tmp/out"
|
|
|
|
|
+bind-key \-temacs-copy C-q copy-pipe "cat >/tmp/out"
|
|
|
|
|
.Ed
|
|
|
|
|
.Pp
|
|
|
|
|
The paste buffer key pastes the first line from the top paste buffer on the
|
|
|
|
|
@@ -1150,7 +1150,7 @@
|
|
|
|
|
and the result executed as a command.
|
|
|
|
|
If
|
|
|
|
|
.Ar template
|
|
|
|
|
-is not given, "detach-client -t '%%'" is used.
|
|
|
|
|
+is not given, "detach-client \-t '%%'" is used.
|
|
|
|
|
For the meaning of the
|
|
|
|
|
.Fl F
|
|
|
|
|
flag, see the
|
|
|
|
|
@@ -1198,7 +1198,7 @@
|
|
|
|
|
and the result executed as a command.
|
|
|
|
|
If
|
|
|
|
|
.Ar template
|
|
|
|
|
-is not given, "switch-client -t '%%'" is used.
|
|
|
|
|
+is not given, "switch-client \-t '%%'" is used.
|
|
|
|
|
For the meaning of the
|
|
|
|
|
.Fl F
|
|
|
|
|
flag, see the
|
|
|
|
|
@@ -1245,7 +1245,7 @@
|
|
|
|
|
Note that
|
|
|
|
|
.Ql %%
|
|
|
|
|
can be used and will be replaced with the session name.
|
|
|
|
|
-The default option if not specified is "switch-client -t '%%'".
|
|
|
|
|
+The default option if not specified is "switch-client \-t '%%'".
|
|
|
|
|
If
|
|
|
|
|
.Fl c
|
|
|
|
|
is given, will override the default window command.
|
|
|
|
|
@@ -1288,7 +1288,7 @@
|
|
|
|
|
and the result executed as a command.
|
|
|
|
|
If
|
|
|
|
|
.Ar template
|
|
|
|
|
-is not given, "select-window -t '%%'" is used.
|
|
|
|
|
+is not given, "select-window \-t '%%'" is used.
|
|
|
|
|
For the meaning of the
|
|
|
|
|
.Fl F
|
|
|
|
|
flag, see the
|
|
|
|
|
@@ -1592,7 +1592,7 @@
|
|
|
|
|
option only opens a new pipe if no previous pipe exists, allowing a pipe to
|
|
|
|
|
be toggled with a single key, for example:
|
|
|
|
|
.Bd -literal -offset indent
|
|
|
|
|
-bind-key C-p pipe-pane -o 'cat >>~/output.#I-#P'
|
|
|
|
|
+bind-key C-p pipe-pane \-o 'cat >>~/output.#I-#P'
|
|
|
|
|
.Ed
|
|
|
|
|
.It Xo Ic previous-layout
|
|
|
|
|
.Op Fl t Ar target-window
|
|
|
|
|
@@ -2039,8 +2039,8 @@
|
|
|
|
|
and be set to any string.
|
|
|
|
|
For example
|
|
|
|
|
.Bd -literal -offset indent
|
|
|
|
|
-$ tmux setw -q @foo "abc123"
|
|
|
|
|
-$ tmux showw -v @foo
|
|
|
|
|
+$ tmux setw \-q @foo "abc123"
|
|
|
|
|
+$ tmux showw \-v @foo
|
|
|
|
|
abc123
|
|
|
|
|
.Ed
|
|
|
|
|
.Pp
|
|
|
|
|
@@ -2537,7 +2537,7 @@
|
|
|
|
|
Examples are:
|
|
|
|
|
.Bd -literal -offset indent
|
|
|
|
|
#(sysctl vm.loadavg)
|
|
|
|
|
-#[fg=yellow,bold]#(apm -l)%%#[default] [#S]
|
|
|
|
|
+#[fg=yellow,bold]#(apm \-l)%%#[default] [#S]
|
|
|
|
|
.Ed
|
|
|
|
|
.Pp
|
|
|
|
|
Where appropriate, special character sequences may be prefixed with a number to
|
|
|
|
|
@@ -2770,7 +2770,7 @@
|
|
|
|
|
or with a terminal escape sequence.
|
|
|
|
|
It may be switched off globally with:
|
|
|
|
|
.Bd -literal -offset indent
|
|
|
|
|
-set-window-option -g automatic-rename off
|
|
|
|
|
+set-window-option \-g automatic-rename off
|
|
|
|
|
.Ed
|
|
|
|
|
.Pp
|
|
|
|
|
.It Ic automatic-rename-format Ar format
|
|
|
|
|
@@ -3479,7 +3479,7 @@
|
|
|
|
|
and the result executed as a command.
|
|
|
|
|
If
|
|
|
|
|
.Ar template
|
|
|
|
|
-is not given, "paste-buffer -b '%%'" is used.
|
|
|
|
|
+is not given, "paste-buffer \-b '%%'" is used.
|
|
|
|
|
For the meaning of the
|
|
|
|
|
.Fl F
|
|
|
|
|
flag, see the
|
|
|
|
|
@@ -3827,22 +3827,22 @@
|
|
|
|
|
.Pp
|
|
|
|
|
Changing the default prefix key:
|
|
|
|
|
.Bd -literal -offset indent
|
|
|
|
|
-set-option -g prefix C-a
|
|
|
|
|
+set-option \-g prefix C-a
|
|
|
|
|
unbind-key C-b
|
|
|
|
|
bind-key C-a send-prefix
|
|
|
|
|
.Ed
|
|
|
|
|
.Pp
|
|
|
|
|
Turning the status line off, or changing its colour:
|
|
|
|
|
.Bd -literal -offset indent
|
|
|
|
|
-set-option -g status off
|
|
|
|
|
-set-option -g status-style bg=blue
|
|
|
|
|
+set-option \-g status off
|
|
|
|
|
+set-option \-g status-style bg=blue
|
|
|
|
|
.Ed
|
|
|
|
|
.Pp
|
|
|
|
|
Setting other options, such as the default command,
|
|
|
|
|
or locking after 30 minutes of inactivity:
|
|
|
|
|
.Bd -literal -offset indent
|
|
|
|
|
-set-option -g default-command "exec /bin/ksh"
|
|
|
|
|
-set-option -g lock-after-time 1800
|
|
|
|
|
+set-option \-g default-command "exec /bin/ksh"
|
|
|
|
|
+set-option \-g lock-after-time 1800
|
|
|
|
|
.Ed
|
|
|
|
|
.Pp
|
|
|
|
|
Creating new key bindings:
|
|
|
|
|
Index: tty-keys.c
|
|
|
|
|
--- tty-keys.c.orig 2014-02-22 21:48:37.000000000 +0100
|
|
|
|
|
+++ tty-keys.c 2015-02-06 19:30:27.904082307 +0100
|
|
|
|
|
@@ -529,8 +529,6 @@
|
|
|
|
|
* used. termios should have a better idea.
|
|
|
|
|
*/
|
|
|
|
|
bspace = tty->tio.c_cc[VERASE];
|
|
|
|
|
- if (bspace != _POSIX_VDISABLE && key == bspace)
|
|
|
|
|
- key = KEYC_BSPACE;
|
|
|
|
|
|
|
|
|
|
goto complete_key;
|
|
|
|
|
|
|
|
|
|
Index: utf8.c
|
|
|
|
|
--- utf8.c.orig 2014-02-22 21:48:37.000000000 +0100
|
|
|
|
|
+++ utf8.c 2015-02-06 19:30:27.915288829 +0100
|
|
|
|
|
@@ -313,7 +313,7 @@
|
|
|
|
|
value = utf8data->data[3] & 0x3f;
|
|
|
|
|
value |= (utf8data->data[2] & 0x3f) << 6;
|
|
|
|
|
value |= (utf8data->data[1] & 0x3f) << 12;
|
|
|
|
|
- value |= (utf8data->data[0] & 0x3f) << 18;
|
|
|
|
|
+ value |= (utf8data->data[0] & 0x07) << 18;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
return (value);
|
|
|
|
|
Index: window-copy.c
|
|
|
|
|
--- window-copy.c.orig 2014-02-22 21:48:37.000000000 +0100
|
|
|
|
|
+++ window-copy.c 2015-02-06 19:30:27.915288829 +0100
|
|
|
|
|
@@ -1185,8 +1185,8 @@
|
|
|
|
|
screen_write_puts(ctx, &gc, "%s", hdr);
|
|
|
|
|
} else if (py == last && data->inputtype != WINDOW_COPY_OFF) {
|
|
|
|
|
limit = sizeof hdr;
|
|
|
|
|
- if (limit > screen_size_x(s))
|
|
|
|
|
- limit = screen_size_x(s);
|
|
|
|
|
+ if (limit > screen_size_x(s) + 1)
|
|
|
|
|
+ limit = screen_size_x(s) + 1;
|
|
|
|
|
if (data->inputtype == WINDOW_COPY_NUMERICPREFIX) {
|
|
|
|
|
xoff = size = xsnprintf(hdr, limit,
|
|
|
|
|
"Repeat: %u", data->numprefix);
|
|
|
|
|
@@ -1199,10 +1199,12 @@
|
|
|
|
|
} else
|
|
|
|
|
size = 0;
|
|
|
|
|
|
|
|
|
|
- screen_write_cursormove(ctx, xoff, py);
|
|
|
|
|
- screen_write_copy(ctx, data->backing, xoff,
|
|
|
|
|
- (screen_hsize(data->backing) - data->oy) + py,
|
|
|
|
|
- screen_size_x(s) - size, 1);
|
|
|
|
|
+ if (size < screen_size_x(s)) {
|
|
|
|
|
+ screen_write_cursormove(ctx, xoff, py);
|
|
|
|
|
+ screen_write_copy(ctx, data->backing, xoff,
|
|
|
|
|
+ (screen_hsize(data->backing) - data->oy) + py,
|
|
|
|
|
+ screen_size_x(s) - size, 1);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
if (py == data->cy && data->cx == screen_size_x(s)) {
|
|
|
|
|
memcpy(&gc, &grid_default_cell, sizeof gc);
|
|
|
|
|
Index: window.c
|
|
|
|
|
--- window.c.orig 2014-02-22 21:48:44.000000000 +0100
|
|
|
|
|
+++ window.c 2015-02-06 19:30:31.615416988 +0100
|
|
|
|
|
@@ -420,10 +420,15 @@
|
|
|
|
|
void
|
|
|
|
|
window_pane_active_lost(struct window_pane *wp, struct window_pane *nextwp)
|
|
|
|
|
{
|
|
|
|
|
- struct layout_cell *lc, *lc2;
|
|
|
|
|
+ struct layout_cell *lc, *lc2, *lcparent;
|
|
|
|
|
+
|
|
|
|
|
+ /* Get the parent cell. */
|
|
|
|
|
+ lcparent = nextwp->layout_cell->parent;
|
|
|
|
|
+ if (lcparent == NULL)
|
|
|
|
|
+ return;
|
|
|
|
|
|
|
|
|
|
/* Save the target pane in its parent. */
|
|
|
|
|
- nextwp->layout_cell->parent->lastwp = nextwp;
|
|
|
|
|
+ lcparent->lastwp = nextwp;
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Save the source pane in all of its parents up to, but not including,
|
|
|
|
|
@@ -432,8 +437,7 @@
|
|
|
|
|
if (wp == NULL)
|
|
|
|
|
return;
|
|
|
|
|
for (lc = wp->layout_cell->parent; lc != NULL; lc = lc->parent) {
|
|
|
|
|
- lc2 = nextwp->layout_cell->parent;
|
|
|
|
|
- for (; lc2 != NULL; lc2 = lc2->parent) {
|
|
|
|
|
+ for (lc2 = lcparent; lc2 != NULL; lc2 = lc2->parent) {
|
|
|
|
|
if (lc == lc2)
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|