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 CHANGES FROM 2.1 to 2.2 10 April 2016



details:   https://anonhg.NetBSD.org/src/rev/6806faf520ab
branches:  trunk
changeset: 817663:6806faf520ab
user:      christos <christos%NetBSD.org@localhost>
date:      Wed Aug 31 09:03:59 2016 +0000

description:
CHANGES FROM 2.1 to 2.2 10 April 2016

Incompatible Changes
====================

* The format strings which referenced time have been removed.  Instead:

  #{t:window_activity}

can be used.

* Support for TMPDIR has been removed.  Use TMUX_TMPDIR instead.
* UTF8 detection how happens automatically if the client supports it, hence
  the:

  mouse-utf8
  utf8

  options has been removed.
* The:

  mouse_utf8_flag

  format string has been removed.
* The -I option to show-messages has been removed.  See:

  #{t:start_time}

  format option instead.

Normal Changes
==============

* Panes are unzoomed with selectp -LRUD
* New formats added:

  #{scroll_position}
  #{socket_path}
  #{=10:...} -- limit to N characters (from the start)
  #{=-10:...} -- limit to N characters (from the end)
  #{t:...} -- used to format time-based formats
  #{b:...} -- used to ascertain basename from string
  #{d:...} -- used to ascertain dirname from string
  #{s:...} -- used to perform substitutions on a string

* Job output is run via the format system, so formats work again
* If display-time is set to 0, then the indicators wait for a key to be
  pressed.
* list-keys and list-commands can be run without starting the tmux server.
* kill-session learns -C to clear all alerts in all windows of the session.
* Support for hooks (internal for now), but hooks for the following have been
  implemented:

  alert-bell
  alert-silence
  alert-activity
  client-attached
  client-detached
  client-resized
  pane-died
  pane-exited

* RGB (24bit) colour support.  The 'Tc' flag must be set in the external TERM
  entry (using terminal-overrides or a custom terminfo entry).

diffstat:

 external/bsd/tmux/dist/alerts.c               |  117 +++-
 external/bsd/tmux/dist/arguments.c            |   88 +--
 external/bsd/tmux/dist/array.h                |    2 +-
 external/bsd/tmux/dist/cfg.c                  |    4 +-
 external/bsd/tmux/dist/cmd-attach-session.c   |  104 +--
 external/bsd/tmux/dist/cmd-bind-key.c         |   25 +-
 external/bsd/tmux/dist/cmd-break-pane.c       |   44 +-
 external/bsd/tmux/dist/cmd-choose-buffer.c    |   30 +-
 external/bsd/tmux/dist/cmd-choose-client.c    |   28 +-
 external/bsd/tmux/dist/cmd-choose-tree.c      |   58 +-
 external/bsd/tmux/dist/cmd-clear-history.c    |   26 +-
 external/bsd/tmux/dist/cmd-command-prompt.c   |   23 +-
 external/bsd/tmux/dist/cmd-confirm-before.c   |   20 +-
 external/bsd/tmux/dist/cmd-copy-mode.c        |   37 +-
 external/bsd/tmux/dist/cmd-detach-client.c    |   65 +-
 external/bsd/tmux/dist/cmd-display-panes.c    |   27 +-
 external/bsd/tmux/dist/cmd-find-window.c      |   29 +-
 external/bsd/tmux/dist/cmd-find.c             |  579 +++++++++++++------------
 external/bsd/tmux/dist/cmd-join-pane.c        |   45 +-
 external/bsd/tmux/dist/cmd-kill-pane.c        |   24 +-
 external/bsd/tmux/dist/cmd-kill-server.c      |   30 +-
 external/bsd/tmux/dist/cmd-kill-session.c     |   29 +-
 external/bsd/tmux/dist/cmd-kill-window.c      |   44 +-
 external/bsd/tmux/dist/cmd-list-buffers.c     |   21 +-
 external/bsd/tmux/dist/cmd-list-clients.c     |   27 +-
 external/bsd/tmux/dist/cmd-list-keys.c        |   73 +-
 external/bsd/tmux/dist/cmd-list-panes.c       |   34 +-
 external/bsd/tmux/dist/cmd-list-sessions.c    |   19 +-
 external/bsd/tmux/dist/cmd-list-windows.c     |   32 +-
 external/bsd/tmux/dist/cmd-list.c             |   37 +-
 external/bsd/tmux/dist/cmd-lock-server.c      |   67 +-
 external/bsd/tmux/dist/cmd-move-window.c      |   62 +-
 external/bsd/tmux/dist/cmd-new-session.c      |  151 +++---
 external/bsd/tmux/dist/cmd-pipe-pane.c        |   35 +-
 external/bsd/tmux/dist/cmd-queue.c            |   59 +-
 external/bsd/tmux/dist/cmd-refresh-client.c   |   22 +-
 external/bsd/tmux/dist/cmd-rename-session.c   |   22 +-
 external/bsd/tmux/dist/cmd-rename-window.c    |   25 +-
 external/bsd/tmux/dist/cmd-resize-pane.c      |   31 +-
 external/bsd/tmux/dist/cmd-respawn-pane.c     |   49 +-
 external/bsd/tmux/dist/cmd-respawn-window.c   |   53 +-
 external/bsd/tmux/dist/cmd-rotate-window.c    |   26 +-
 external/bsd/tmux/dist/cmd-run-shell.c        |   52 +-
 external/bsd/tmux/dist/cmd-save-buffer.c      |   74 +-
 external/bsd/tmux/dist/cmd-select-layout.c    |   52 +-
 external/bsd/tmux/dist/cmd-select-pane.c      |   67 +-
 external/bsd/tmux/dist/cmd-select-window.c    |   75 +-
 external/bsd/tmux/dist/cmd-set-buffer.c       |   28 +-
 external/bsd/tmux/dist/cmd-set-environment.c  |   36 +-
 external/bsd/tmux/dist/cmd-set-hook.c         |  120 +++++
 external/bsd/tmux/dist/cmd-set-option.c       |  155 +++---
 external/bsd/tmux/dist/cmd-show-environment.c |   44 +-
 external/bsd/tmux/dist/cmd-show-options.c     |  118 +++--
 external/bsd/tmux/dist/cmd-source-file.c      |   16 +-
 external/bsd/tmux/dist/cmd-swap-pane.c        |   59 +-
 external/bsd/tmux/dist/cmd-swap-window.c      |   37 +-
 external/bsd/tmux/dist/cmd-switch-client.c    |   76 +--
 external/bsd/tmux/dist/cmd-unbind-key.c       |   32 +-
 external/bsd/tmux/dist/cmd.c                  |  205 ++++++++-
 external/bsd/tmux/dist/compat.h               |   14 +-
 external/bsd/tmux/dist/compat/cfmakeraw.c     |    2 +-
 external/bsd/tmux/dist/compat/openat.c        |    2 +-
 external/bsd/tmux/dist/compat/reallocarray.c  |   40 +
 external/bsd/tmux/dist/control-notify.c       |   23 +-
 external/bsd/tmux/dist/control.c              |    8 +-
 external/bsd/tmux/dist/example_tmux.conf      |   66 ++
 external/bsd/tmux/dist/grid-view.c            |   21 +-
 external/bsd/tmux/dist/hooks.c                |  226 ++++++++++
 external/bsd/tmux/dist/key-string.c           |  103 +++-
 external/bsd/tmux/dist/layout-custom.c        |    2 +-
 external/bsd/tmux/dist/layout-set.c           |   10 +-
 external/bsd/tmux/dist/layout.c               |   24 +-
 external/bsd/tmux/dist/mode-key.c             |   20 +-
 external/bsd/tmux/dist/names.c                |   10 +-
 external/bsd/tmux/dist/options-table.c        |  206 ++++++--
 external/bsd/tmux/dist/osdep-aix.c            |    4 +-
 external/bsd/tmux/dist/osdep-cygwin.c         |    4 +-
 external/bsd/tmux/dist/osdep-darwin.c         |    4 +-
 external/bsd/tmux/dist/osdep-dragonfly.c      |    2 +-
 external/bsd/tmux/dist/osdep-freebsd.c        |    2 +-
 external/bsd/tmux/dist/osdep-hpux.c           |    6 +-
 external/bsd/tmux/dist/osdep-linux.c          |    4 +-
 external/bsd/tmux/dist/osdep-netbsd.c         |    2 +-
 external/bsd/tmux/dist/osdep-openbsd.c        |    2 +-
 external/bsd/tmux/dist/osdep-unknown.c        |    4 +-
 external/bsd/tmux/dist/proc.c                 |  268 ++++++++++++
 external/bsd/tmux/dist/resize.c               |   10 +-
 external/bsd/tmux/dist/screen-redraw.c        |   12 +-
 external/bsd/tmux/dist/server-client.c        |  575 +++++++++++++++----------
 external/bsd/tmux/dist/server.c               |  168 ++----
 external/bsd/tmux/dist/signal.c               |   16 +-
 external/bsd/tmux/dist/style.c                |    2 +-
 external/bsd/tmux/dist/tty.c                  |  336 +++++++++-----
 external/bsd/tmux/dist/utf8.c                 |  547 +++++++++--------------
 external/bsd/tmux/dist/window-choose.c        |   70 +-
 external/bsd/tmux/dist/window-clock.c         |   15 +-
 external/bsd/tmux/dist/xmalloc.c              |  141 ++---
 external/bsd/tmux/dist/xmalloc.h              |   44 +
 external/bsd/tmux/dist/xterm-keys.c           |   23 +-
 99 files changed, 3993 insertions(+), 2614 deletions(-)

diffs (truncated from 12072 to 300 lines):

diff -r 7666ca760791 -r 6806faf520ab external/bsd/tmux/dist/alerts.c
--- a/external/bsd/tmux/dist/alerts.c   Wed Aug 31 08:12:44 2016 +0000
+++ b/external/bsd/tmux/dist/alerts.c   Wed Aug 31 09:03:59 2016 +0000
@@ -1,7 +1,7 @@
 /* $OpenBSD$ */
 
 /*
- * Copyright (c) 2015 Nicholas Marriott <nicm%users.sourceforge.net@localhost>
+ * Copyright (c) 2015 Nicholas Marriott <nicholas.marriott%gmail.com@localhost>
  *
  * Permission to use, copy, modify, and distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
@@ -29,13 +29,15 @@
 void   alerts_callback(int, short, void *);
 void   alerts_reset(struct window *);
 
+void   alerts_run_hook(struct session *, struct winlink *, int);
+int    alerts_check_all(struct session *, struct winlink *);
 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)
+alerts_timer(__unused int fd, __unused short events, void *arg)
 {
        struct window   *w = arg;
 
@@ -45,7 +47,7 @@
 }
 
 void
-alerts_callback(unused int fd, unused short events, unused void *arg)
+alerts_callback(__unused int fd, __unused short events, __unused void *arg)
 {
        struct window   *w;
        struct session  *s;
@@ -59,11 +61,7 @@
                                        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);
+                               alerts = alerts_check_all(s, wl);
 
                                log_debug("%s:%d @%u alerts check, alerts %#x, "
                                    "flags %#x", s->name, wl->idx, w->id,
@@ -74,25 +72,58 @@
        alerts_fired = 0;
 }
 
+void
+alerts_run_hook(struct session *s, struct winlink *wl, int flags)
+{
+       struct cmd_find_state    fs;
+
+       if (cmd_find_from_winlink(&fs, s, wl) != 0)
+               return;
+
+       if (flags & WINDOW_BELL)
+               hooks_run(s->hooks, NULL, &fs, "alert-bell");
+       if (flags & WINDOW_SILENCE)
+               hooks_run(s->hooks, NULL, &fs, "alert-silence");
+       if (flags & WINDOW_ACTIVITY)
+               hooks_run(s->hooks, NULL, &fs, "alert-activity");
+}
+
+int
+alerts_check_all(struct session *s, struct winlink *wl)
+{
+       int     alerts;
+
+       alerts  = alerts_check_bell(s, wl);
+       alerts |= alerts_check_activity(s, wl);
+       alerts |= alerts_check_silence(s, wl);
+       if (alerts != 0) {
+               alerts_run_hook(s, wl, alerts);
+               server_status_session(s);
+       }
+
+       return (alerts);
+}
+
+void
+alerts_check_session(struct session *s)
+{
+       struct winlink  *wl;
+
+       RB_FOREACH(wl, winlinks, &s->windows)
+               alerts_check_all(s, wl);
+}
+
 int
 alerts_enabled(struct window *w, int flags)
 {
-       struct session  *s;
-
+       if (flags & WINDOW_BELL)
+               return (1);
        if (flags & WINDOW_ACTIVITY) {
-               if (options_get_number(&w->options, "monitor-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)
+               if (options_get_number(w->options, "monitor-silence") != 0)
                        return (1);
        }
        return (0);
@@ -116,7 +147,7 @@
        event_del(&w->alerts_timer);
 
        timerclear(&tv);
-       tv.tv_sec = options_get_number(&w->options, "monitor-silence");
+       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)
@@ -132,15 +163,15 @@
        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) {
+               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;
+               if (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;
+               }
        }
 }
 
@@ -151,20 +182,20 @@
        struct window   *w = wl->window;
        int              action, visual;
 
-       if (!(w->flags & WINDOW_BELL) || wl->flags & WINLINK_BELL)
+       if (!(w->flags & WINDOW_BELL))
                return (0);
-       if (s->curw != wl || s->flags & SESSION_UNATTACHED)
+       if (s->curw != wl) {
                wl->flags |= WINLINK_BELL;
-       if (s->flags & SESSION_UNATTACHED)
-               return (0);
+               w->flags &= ~WINDOW_BELL;
+       }
        if (s->curw->window == w)
                w->flags &= ~WINDOW_BELL;
 
-       action = options_get_number(&s->options, "bell-action");
+       action = options_get_number(s->options, "bell-action");
        if (action == BELL_NONE)
                return (0);
 
-       visual = options_get_number(&s->options, "visual-bell");
+       visual = options_get_number(s->options, "visual-bell");
        TAILQ_FOREACH(c, &clients, entry) {
                if (c->session != s || c->flags & CLIENT_CONTROL)
                        continue;
@@ -198,17 +229,17 @@
 
        if (!(w->flags & WINDOW_ACTIVITY) || wl->flags & WINLINK_ACTIVITY)
                return (0);
-       if (s->curw == wl && !(s->flags & SESSION_UNATTACHED))
+       if (s->curw == wl)
                return (0);
 
-       if (!options_get_number(&w->options, "monitor-activity"))
+       if (!options_get_number(w->options, "monitor-activity"))
                return (0);
 
-       if (options_get_number(&s->options, "bell-on-alert"))
+       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")) {
+       if (options_get_number(s->options, "visual-activity")) {
                TAILQ_FOREACH(c, &clients, entry) {
                        if (c->session != s)
                                continue;
@@ -230,17 +261,17 @@
 
        if (!(w->flags & WINDOW_SILENCE) || wl->flags & WINLINK_SILENCE)
                return (0);
-       if (s->curw == wl && !(s->flags & SESSION_UNATTACHED))
+       if (s->curw == wl)
                return (0);
 
-       if (options_get_number(&w->options, "monitor-silence") == 0)
+       if (options_get_number(w->options, "monitor-silence") == 0)
                return (0);
 
-       if (options_get_number(&s->options, "bell-on-alert"))
+       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")) {
+       if (options_get_number(s->options, "visual-silence")) {
                TAILQ_FOREACH(c, &clients, entry) {
                        if (c->session != s)
                                continue;
diff -r 7666ca760791 -r 6806faf520ab external/bsd/tmux/dist/arguments.c
--- a/external/bsd/tmux/dist/arguments.c        Wed Aug 31 08:12:44 2016 +0000
+++ b/external/bsd/tmux/dist/arguments.c        Wed Aug 31 09:03:59 2016 +0000
@@ -1,7 +1,7 @@
 /* $OpenBSD$ */
 
 /*
- * Copyright (c) 2010 Nicholas Marriott <nicm%users.sourceforge.net@localhost>
+ * Copyright (c) 2010 Nicholas Marriott <nicholas.marriott%gmail.com@localhost>
  *
  * Permission to use, copy, modify, and distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
@@ -127,77 +127,73 @@
        free(args);
 }
 
-/* Print a set of arguments. */
-size_t
-args_print(struct args *args, char *buf, size_t len)
+/* Add to string. */
+static void printflike(3, 4)
+args_print_add(char **buf, size_t *len, const char *fmt, ...)
 {
-       size_t                   off, used;
+       va_list  ap;
+       char    *s;
+       size_t   slen;
+
+       va_start(ap, fmt);
+       slen = xvasprintf(&s, fmt, ap);
+       va_end(ap);
+
+       *len += slen;
+       *buf = xrealloc(*buf, *len);
+
+       strlcat(*buf, s, *len);
+       free(s);
+}
+
+/* Print a set of arguments. */
+char *
+args_print(struct args *args)
+{
+       size_t                   len;
+       char                    *buf;
        int                      i;
-       const char              *quotes;
        struct args_entry       *entry;
 
-       /* There must be at least one byte at the start. */
-       if (len == 0)
-               return (0);
-       off = 0;
+       len = 1;
+       buf = xcalloc(1, len);
 
        /* Process the flags first. */
-       buf[off++] = '-';
        RB_FOREACH(entry, args_tree, &args->tree) {
                if (entry->value != NULL)
                        continue;
 
-               if (off == len - 1) {
-                       buf[off] = '\0';
-                       return (len);
-               }
-               buf[off++] = entry->flag;
-               buf[off] = '\0';
+               if (*buf == '\0')
+                       args_print_add(&buf, &len, "-");
+               args_print_add(&buf, &len, "%c", entry->flag);
        }
-       if (off == 1)
-               buf[--off] = '\0';



Home | Main Index | Thread Index | Old Index