Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/external/bsd/tmux/dist import new tmux
details: https://anonhg.NetBSD.org/src/rev/c113d529bfcc
branches: trunk
changeset: 342832:c113d529bfcc
user: christos <christos%NetBSD.org@localhost>
date: Sun Jan 10 17:55:36 2016 +0000
description:
import new tmux
diffstat:
external/bsd/tmux/dist/alerts.c | 263 +++++
external/bsd/tmux/dist/arguments.c | 20 +-
external/bsd/tmux/dist/array.h | 6 +-
external/bsd/tmux/dist/attributes.c | 2 +-
external/bsd/tmux/dist/cfg.c | 174 ++-
external/bsd/tmux/dist/cmd-attach-session.c | 141 +-
external/bsd/tmux/dist/cmd-bind-key.c | 55 +-
external/bsd/tmux/dist/cmd-break-pane.c | 64 +-
external/bsd/tmux/dist/cmd-choose-buffer.c | 23 +-
external/bsd/tmux/dist/cmd-choose-client.c | 38 +-
external/bsd/tmux/dist/cmd-choose-tree.c | 16 +-
external/bsd/tmux/dist/cmd-clear-history.c | 8 +-
external/bsd/tmux/dist/cmd-command-prompt.c | 34 +-
external/bsd/tmux/dist/cmd-confirm-before.c | 28 +-
external/bsd/tmux/dist/cmd-copy-mode.c | 45 +-
external/bsd/tmux/dist/cmd-detach-client.c | 70 +-
external/bsd/tmux/dist/cmd-display-panes.c | 3 +-
external/bsd/tmux/dist/cmd-find-window.c | 82 +-
external/bsd/tmux/dist/cmd-find.c | 1228 ++++++++++++++++++++++++
external/bsd/tmux/dist/cmd-join-pane.c | 31 +-
external/bsd/tmux/dist/cmd-kill-pane.c | 3 +-
external/bsd/tmux/dist/cmd-kill-server.c | 4 +-
external/bsd/tmux/dist/cmd-kill-session.c | 13 +-
external/bsd/tmux/dist/cmd-kill-window.c | 33 +-
external/bsd/tmux/dist/cmd-list-buffers.c | 14 +-
external/bsd/tmux/dist/cmd-list-clients.c | 26 +-
external/bsd/tmux/dist/cmd-list-keys.c | 125 +-
external/bsd/tmux/dist/cmd-list-panes.c | 30 +-
external/bsd/tmux/dist/cmd-list-sessions.c | 13 +-
external/bsd/tmux/dist/cmd-list-windows.c | 23 +-
external/bsd/tmux/dist/cmd-list.c | 14 +-
external/bsd/tmux/dist/cmd-load-buffer.c | 62 +-
external/bsd/tmux/dist/cmd-lock-server.c | 9 +-
external/bsd/tmux/dist/cmd-move-window.c | 45 +-
external/bsd/tmux/dist/cmd-new-session.c | 112 +-
external/bsd/tmux/dist/cmd-new-window.c | 72 +-
external/bsd/tmux/dist/cmd-pipe-pane.c | 25 +-
external/bsd/tmux/dist/cmd-queue.c | 140 +-
external/bsd/tmux/dist/cmd-refresh-client.c | 9 +-
external/bsd/tmux/dist/cmd-rename-session.c | 3 +-
external/bsd/tmux/dist/cmd-rename-window.c | 3 +-
external/bsd/tmux/dist/cmd-resize-pane.c | 116 +-
external/bsd/tmux/dist/cmd-respawn-pane.c | 23 +-
external/bsd/tmux/dist/cmd-respawn-window.c | 22 +-
external/bsd/tmux/dist/cmd-rotate-window.c | 12 +-
external/bsd/tmux/dist/cmd-run-shell.c | 37 +-
external/bsd/tmux/dist/cmd-save-buffer.c | 48 +-
external/bsd/tmux/dist/cmd-select-layout.c | 109 +-
external/bsd/tmux/dist/cmd-select-pane.c | 123 +-
external/bsd/tmux/dist/cmd-select-window.c | 21 +-
external/bsd/tmux/dist/cmd-set-buffer.c | 90 +-
external/bsd/tmux/dist/cmd-set-environment.c | 3 +-
external/bsd/tmux/dist/cmd-set-option.c | 158 +-
external/bsd/tmux/dist/cmd-show-environment.c | 71 +-
external/bsd/tmux/dist/cmd-show-options.c | 24 +-
external/bsd/tmux/dist/cmd-source-file.c | 25 +-
external/bsd/tmux/dist/cmd-split-window.c | 77 +-
external/bsd/tmux/dist/cmd-swap-pane.c | 20 +-
external/bsd/tmux/dist/cmd-swap-window.c | 5 +-
external/bsd/tmux/dist/cmd-switch-client.c | 66 +-
external/bsd/tmux/dist/cmd-unbind-key.c | 46 +-
external/bsd/tmux/dist/cmd.c | 1089 +++------------------
external/bsd/tmux/dist/compat.h | 18 +-
external/bsd/tmux/dist/compat/cfmakeraw.c | 2 -
external/bsd/tmux/dist/compat/fparseln.c | 221 ++++
external/bsd/tmux/dist/compat/imsg.h | 12 +-
external/bsd/tmux/dist/compat/openat.c | 8 +-
external/bsd/tmux/dist/control-notify.c | 47 +-
external/bsd/tmux/dist/control.c | 6 +-
external/bsd/tmux/dist/examples/tmux.vim | 17 +-
external/bsd/tmux/dist/examples/xterm-keys.vim | 4 +-
external/bsd/tmux/dist/grid-view.c | 30 +-
external/bsd/tmux/dist/key-bindings.c | 313 +++--
external/bsd/tmux/dist/key-string.c | 27 +-
external/bsd/tmux/dist/layout-custom.c | 6 +-
external/bsd/tmux/dist/layout-set.c | 12 +-
external/bsd/tmux/dist/layout.c | 59 +-
external/bsd/tmux/dist/mode-key.c | 51 +-
external/bsd/tmux/dist/names.c | 83 +-
external/bsd/tmux/dist/notify.c | 12 +-
external/bsd/tmux/dist/options-table.c | 218 +--
external/bsd/tmux/dist/osdep-aix.c | 66 +-
external/bsd/tmux/dist/osdep-cygwin.c | 88 +
external/bsd/tmux/dist/osdep-darwin.c | 2 +-
external/bsd/tmux/dist/osdep-dragonfly.c | 2 +-
external/bsd/tmux/dist/osdep-freebsd.c | 38 +-
external/bsd/tmux/dist/osdep-hpux.c | 2 +-
external/bsd/tmux/dist/osdep-linux.c | 14 +-
external/bsd/tmux/dist/osdep-netbsd.c | 2 +-
external/bsd/tmux/dist/osdep-openbsd.c | 9 +-
external/bsd/tmux/dist/osdep-sunos.c | 13 +-
external/bsd/tmux/dist/osdep-unknown.c | 2 +-
external/bsd/tmux/dist/paste.c | 310 ++++--
external/bsd/tmux/dist/resize.c | 32 +-
external/bsd/tmux/dist/screen-redraw.c | 112 +-
external/bsd/tmux/dist/server-client.c | 726 +++++++++-----
external/bsd/tmux/dist/server.c | 336 ++---
external/bsd/tmux/dist/signal.c | 4 +-
external/bsd/tmux/dist/style.c | 60 +-
external/bsd/tmux/dist/tty.c | 370 ++++--
external/bsd/tmux/dist/utf8.c | 172 +++-
external/bsd/tmux/dist/window-choose.c | 178 +-
external/bsd/tmux/dist/window-clock.c | 202 +++-
external/bsd/tmux/dist/xmalloc.c | 28 +-
external/bsd/tmux/dist/xterm-keys.c | 91 +-
105 files changed, 5758 insertions(+), 3541 deletions(-)
diffs (truncated from 14986 to 300 lines):
diff -r a75748362009 -r c113d529bfcc external/bsd/tmux/dist/alerts.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/external/bsd/tmux/dist/alerts.c Sun Jan 10 17:55:36 2016 +0000
@@ -0,0 +1,263 @@
+/* $OpenBSD$ */
+
+/*
+ * Copyright (c) 2015 Nicholas Marriott <nicm%users.sourceforge.net@localhost>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
+ * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <sys/types.h>
+
+#include <event.h>
+
+#include "tmux.h"
+
+int alerts_fired;
+
+void alerts_timer(int, short, void *);
+int alerts_enabled(struct window *, int);
+void alerts_callback(int, short, void *);
+void alerts_reset(struct window *);
+
+int alerts_check_bell(struct session *, struct winlink *);
+int alerts_check_activity(struct session *, struct winlink *);
+int alerts_check_silence(struct session *, struct winlink *);
+void alerts_ring_bell(struct session *);
+
+void
+alerts_timer(unused int fd, unused short events, void *arg)
+{
+ struct window *w = arg;
+
+ log_debug("@%u alerts timer expired", w->id);
+ alerts_reset(w);
+ alerts_queue(w, WINDOW_SILENCE);
+}
+
+void
+alerts_callback(unused int fd, unused short events, unused void *arg)
+{
+ struct window *w;
+ struct session *s;
+ struct winlink *wl;
+ int flags, alerts;
+
+ RB_FOREACH(w, windows, &windows) {
+ RB_FOREACH(s, sessions, &sessions) {
+ RB_FOREACH(wl, winlinks, &s->windows) {
+ if (wl->window != w)
+ continue;
+ flags = w->flags;
+
+ alerts = alerts_check_bell(s, wl);
+ alerts |= alerts_check_activity(s, wl);
+ alerts |= alerts_check_silence(s, wl);
+ if (alerts != 0)
+ server_status_session(s);
+
+ log_debug("%s:%d @%u alerts check, alerts %#x, "
+ "flags %#x", s->name, wl->idx, w->id,
+ alerts, flags);
+ }
+ }
+ }
+ alerts_fired = 0;
+}
+
+int
+alerts_enabled(struct window *w, int flags)
+{
+ struct session *s;
+
+ if (flags & WINDOW_ACTIVITY) {
+ if (options_get_number(&w->options, "monitor-activity"))
+ return (1);
+ }
+ if (flags & WINDOW_SILENCE) {
+ if (options_get_number(&w->options, "monitor-silence") != 0)
+ return (1);
+ }
+ if (~flags & WINDOW_BELL)
+ return (0);
+ RB_FOREACH(s, sessions, &sessions) {
+ if (!session_has(s, w))
+ continue;
+ if (options_get_number(&s->options, "bell-action") != BELL_NONE)
+ return (1);
+ }
+ return (0);
+}
+
+void
+alerts_reset_all(void)
+{
+ struct window *w;
+
+ RB_FOREACH(w, windows, &windows)
+ alerts_reset(w);
+}
+
+void
+alerts_reset(struct window *w)
+{
+ struct timeval tv;
+
+ w->flags &= ~WINDOW_SILENCE;
+ event_del(&w->alerts_timer);
+
+ timerclear(&tv);
+ tv.tv_sec = options_get_number(&w->options, "monitor-silence");
+
+ log_debug("@%u alerts timer reset %u", w->id, (u_int)tv.tv_sec);
+ if (tv.tv_sec != 0)
+ event_add(&w->alerts_timer, &tv);
+}
+
+void
+alerts_queue(struct window *w, int flags)
+{
+ if (w->flags & WINDOW_ACTIVITY)
+ alerts_reset(w);
+
+ if (!event_initialized(&w->alerts_timer))
+ evtimer_set(&w->alerts_timer, alerts_timer, w);
+
+ if (w->flags & flags)
+ return;
+ w->flags |= flags;
+ log_debug("@%u alerts flags added %#x", w->id, flags);
+
+ if (!alerts_fired && alerts_enabled(w, flags)) {
+ log_debug("alerts check queued (by @%u)", w->id);
+ event_once(-1, EV_TIMEOUT, alerts_callback, NULL, NULL);
+ alerts_fired = 1;
+ }
+}
+
+int
+alerts_check_bell(struct session *s, struct winlink *wl)
+{
+ struct client *c;
+ struct window *w = wl->window;
+ int action, visual;
+
+ if (!(w->flags & WINDOW_BELL) || wl->flags & WINLINK_BELL)
+ return (0);
+ if (s->curw != wl || s->flags & SESSION_UNATTACHED)
+ wl->flags |= WINLINK_BELL;
+ if (s->flags & SESSION_UNATTACHED)
+ return (0);
+ if (s->curw->window == w)
+ w->flags &= ~WINDOW_BELL;
+
+ action = options_get_number(&s->options, "bell-action");
+ if (action == BELL_NONE)
+ return (0);
+
+ visual = options_get_number(&s->options, "visual-bell");
+ TAILQ_FOREACH(c, &clients, entry) {
+ if (c->session != s || c->flags & CLIENT_CONTROL)
+ continue;
+ if (!visual) {
+ if ((action == BELL_CURRENT &&
+ c->session->curw->window == w) ||
+ (action == BELL_OTHER &&
+ c->session->curw->window != w) ||
+ action == BELL_ANY)
+ tty_putcode(&c->tty, TTYC_BEL);
+ continue;
+ }
+ if (action == BELL_CURRENT && c->session->curw->window == w)
+ status_message_set(c, "Bell in current window");
+ else if (action == BELL_ANY || (action == BELL_OTHER &&
+ c->session->curw->window != w))
+ status_message_set(c, "Bell in window %d", wl->idx);
+ }
+
+ return (WINDOW_BELL);
+}
+
+int
+alerts_check_activity(struct session *s, struct winlink *wl)
+{
+ struct client *c;
+ struct window *w = wl->window;
+
+ if (s->curw->window == w)
+ w->flags &= ~WINDOW_ACTIVITY;
+
+ if (!(w->flags & WINDOW_ACTIVITY) || wl->flags & WINLINK_ACTIVITY)
+ return (0);
+ if (s->curw == wl && !(s->flags & SESSION_UNATTACHED))
+ return (0);
+
+ if (!options_get_number(&w->options, "monitor-activity"))
+ return (0);
+
+ if (options_get_number(&s->options, "bell-on-alert"))
+ alerts_ring_bell(s);
+ wl->flags |= WINLINK_ACTIVITY;
+
+ if (options_get_number(&s->options, "visual-activity")) {
+ TAILQ_FOREACH(c, &clients, entry) {
+ if (c->session != s)
+ continue;
+ status_message_set(c, "Activity in window %d", wl->idx);
+ }
+ }
+
+ return (WINDOW_ACTIVITY);
+}
+
+int
+alerts_check_silence(struct session *s, struct winlink *wl)
+{
+ struct client *c;
+ struct window *w = wl->window;
+
+ if (s->curw->window == w)
+ w->flags &= ~WINDOW_SILENCE;
+
+ if (!(w->flags & WINDOW_SILENCE) || wl->flags & WINLINK_SILENCE)
+ return (0);
+ if (s->curw == wl && !(s->flags & SESSION_UNATTACHED))
+ return (0);
+
+ if (options_get_number(&w->options, "monitor-silence") == 0)
+ return (0);
+
+ if (options_get_number(&s->options, "bell-on-alert"))
+ alerts_ring_bell(s);
+ wl->flags |= WINLINK_SILENCE;
+
+ if (options_get_number(&s->options, "visual-silence")) {
+ TAILQ_FOREACH(c, &clients, entry) {
+ if (c->session != s)
+ continue;
+ status_message_set(c, "Silence in window %d", wl->idx);
+ }
+ }
+
+ return (WINDOW_SILENCE);
+}
+
+void
+alerts_ring_bell(struct session *s)
+{
+ struct client *c;
+
+ TAILQ_FOREACH(c, &clients, entry) {
+ if (c->session == s && !(c->flags & CLIENT_CONTROL))
+ tty_putcode(&c->tty, TTYC_BEL);
+ }
+}
diff -r a75748362009 -r c113d529bfcc external/bsd/tmux/dist/arguments.c
--- a/external/bsd/tmux/dist/arguments.c Sun Jan 10 17:44:48 2016 +0000
+++ b/external/bsd/tmux/dist/arguments.c Sun Jan 10 17:55:36 2016 +0000
@@ -1,4 +1,4 @@
-/* Id */
+/* $OpenBSD$ */
/*
* Copyright (c) 2010 Nicholas Marriott <nicm%users.sourceforge.net@localhost>
@@ -28,6 +28,12 @@
* Manipulate command arguments.
*/
+struct args_entry {
+ u_char flag;
+ char *value;
+ RB_ENTRY(args_entry) entry;
+};
+
struct args_entry *args_find(struct args *, u_char);
RB_GENERATE(args_tree, args_entry, entry, args_cmp);
@@ -125,7 +131,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 +171,12 @@
quotes = "\"";
Home |
Main Index |
Thread Index |
Old Index