The branch, master has been updated
       via  ccbe2545d9857e03731eddb9757989b9f52dc785 (commit)
       via  54ca7b230d08aae0b2028f3f82a259963017c167 (commit)
       via  575fd1e322b15a3e9f0d1892ebb82c2e8a30ba46 (commit)
       via  e52d7912122177ddff952feccc192a3f357b9d1b (commit)
       via  c8bf8ee931e4ccfe709f5ac36fb210e938eeec50 (commit)
       via  c403bfc89488bf3867cee9d5c3b4083a3f80bee6 (commit)
       via  a3612a5472ec5ecf1ffbb1c3cdea58d6b709478d (commit)
      from  3e8efcc555a2767ff0abc121cb3232d7e84c3873 (commit)

- Log -----------------------------------------------------------------
commit ccbe2545d9857e03731eddb9757989b9f52dc785
Merge: 3e8efcc 54ca7b2
Author: Thomas Adam <tho...@xteddy.org>
Commit: Thomas Adam <tho...@xteddy.org>

    Merge branch 'obsd-master'

 cmd-if-shell.c  |   27 ++++++++++++++++--
 format.c        |   80 ++++++++++++++++++++++++++++++++++++++++++++----------
 grid-view.c     |    7 +++--
 log.c           |    2 +-
 tmux.1          |   34 +++++++++++++++++++----
 tmux.h          |   15 +---------
 window-choose.c |   30 --------------------
 7 files changed, 123 insertions(+), 72 deletions(-)

diff --cc format.c
index e7fd3e1,87d6cd4..fff9a69
--- a/format.c
+++ b/format.c
@@@ -534,8 -580,11 +581,11 @@@ format_window_pane(struct format_tree *
        struct grid_line        *gl;
        unsigned long long       size;
        u_int                    i, idx;
 -      char                    *cmd;
 +      char                    *cmd, *cwd;
  
+       if (ft->w == NULL)
+               ft->w = wp->window;
+ 
        size = 0;
        for (i = 0; i < gd->hsize; i++) {
                gl = &gd->linedata[i];


commit 54ca7b230d08aae0b2028f3f82a259963017c167
Author: nicm <nicm>
Commit: nicm <nicm>

    Add -F to if-shell to allow it to be used to check for format or option
    values rather than executing a command.
---
 cmd-if-shell.c |   27 ++++++++++++++++++++++++---
 tmux.1         |   13 +++++++++++--
 2 files changed, 35 insertions(+), 5 deletions(-)

diff --git a/cmd-if-shell.c b/cmd-if-shell.c
index da0220c..1543291 100644
--- a/cmd-if-shell.c
+++ b/cmd-if-shell.c
@@ -37,8 +37,8 @@ void  cmd_if_shell_free(void *);
 
 const struct cmd_entry cmd_if_shell_entry = {
        "if-shell", "if",
-       "bt:", 2, 3,
-       "[-b] " CMD_TARGET_PANE_USAGE " shell-command command [command]",
+       "bFt:", 2, 3,
+       "[-bF] " CMD_TARGET_PANE_USAGE " shell-command command [command]",
        0,
        cmd_if_shell_exec
 };
@@ -56,7 +56,8 @@ cmd_if_shell_exec(struct cmd *self, struct cmd_q *cmdq)
 {
        struct args                     *args = self->args;
        struct cmd_if_shell_data        *cdata;
-       char                            *shellcmd;
+       char                            *shellcmd, *cmd, *cause;
+       struct cmd_list                 *cmdlist;
        struct client                   *c;
        struct session                  *s = NULL;
        struct winlink                  *wl = NULL;
@@ -84,6 +85,26 @@ cmd_if_shell_exec(struct cmd *self, struct cmd_q *cmdq)
        shellcmd = format_expand(ft, args->argv[0]);
        format_free(ft);
 
+       if (args_has(args, 'F')) {
+               cmd = NULL;
+               if (*shellcmd != '0' && *shellcmd != '\0')
+                       cmd = args->argv[1];
+               else if (args->argc == 3)
+                       cmd = args->argv[2];
+               if (cmd == NULL)
+                       return (CMD_RETURN_NORMAL);
+               if (cmd_string_parse(cmd, &cmdlist, NULL, 0, &cause) != 0) {
+                       if (cause != NULL) {
+                               cmdq_error(cmdq, "%s", cause);
+                               free(cause);
+                       }
+                       return (CMD_RETURN_ERROR);
+               }
+               cmdq_run(cmdq, cmdlist);
+               cmd_list_free(cmdlist);
+               return (CMD_RETURN_NORMAL);
+       }
+
        cdata = xmalloc(sizeof *cdata);
        cdata->cmd_if = xstrdup(args->argv[1]);
        if (args->argc == 3)
diff --git a/tmux.1 b/tmux.1
index 949a77b..63ab82b 100644
--- a/tmux.1
+++ b/tmux.1
@@ -3589,7 +3589,7 @@ Miscellaneous commands are as follows:
 .It Ic clock-mode Op Fl t Ar target-pane
 Display a large clock.
 .It Xo Ic if-shell
-.Op Fl b
+.Op Fl bF
 .Op Fl t Ar target-pane
 .Ar shell-command command
 .Op Ar command
@@ -3602,7 +3602,9 @@ if
 returns success or the second
 .Ar command
 otherwise.
-Before being executed, shell-command is expanded using the rules specified in 
the
+Before being executed,
+.Ar shell-command
+is expanded using the rules specified in the
 .Sx FORMATS
 section, including those relevant to
 .Ar target-pane .
@@ -3610,6 +3612,13 @@ With
 .Fl b ,
 .Ar shell-command
 is run in the background.
+.Pp
+If
+.Fl F
+is given,
+.Ar shell-command
+is not executed but considered success if neither empty nor zero (after formats
+are expanded).
 .It Ic lock-server
 .D1 (alias: Ic lock )
 Lock each client individually by running the command specified by the


commit 575fd1e322b15a3e9f0d1892ebb82c2e8a30ba46
Author: nicm <nicm>
Commit: nicm <nicm>

    Permit option values to be used in formats.
---
 format.c |   76 +++++++++++++++++++++++++++++++++++++++++++++++++++----------
 tmux.1   |   21 ++++++++++++++---
 tmux.h   |   12 +---------
 3 files changed, 81 insertions(+), 28 deletions(-)

diff --git a/format.c b/format.c
index 0f4f54c..87d6cd4 100644
--- a/format.c
+++ b/format.c
@@ -39,8 +39,26 @@ int   format_replace(struct format_tree *, const char *, 
size_t, char **,
 char   *format_get_command(struct window_pane *);
 void    format_window_pane_tabs(struct format_tree *, struct window_pane *);
 
+/* Entry in format tree. */
+struct format_entry {
+       char                   *key;
+       char                   *value;
+
+       RB_ENTRY(format_entry)  entry;
+};
+
+/* Tree of format entries. */
+struct format_tree {
+       struct window   *w;
+       struct session  *s;
+
+       RB_HEAD(format_rb_tree, format_entry) tree;
+};
+
 /* Format key-value replacement entry. */
-RB_GENERATE(format_tree, format_entry, entry, format_cmp);
+int    format_cmp(struct format_entry *, struct format_entry *);
+RB_PROTOTYPE(format_rb_tree, format_entry, entry, format_cmp);
+RB_GENERATE(format_rb_tree, format_entry, entry, format_cmp);
 
 /* Format tree comparison function. */
 int
@@ -116,8 +134,8 @@ format_create(void)
        struct format_tree      *ft;
        char                     host[MAXHOSTNAMELEN], *ptr;
 
-       ft = xmalloc(sizeof *ft);
-       RB_INIT(ft);
+       ft = xcalloc(1, sizeof *ft);
+       RB_INIT(&ft->tree);
 
        if (gethostname(host, sizeof host) == 0) {
                format_add(ft, "host", "%s", host);
@@ -133,14 +151,10 @@ format_create(void)
 void
 format_free(struct format_tree *ft)
 {
-       struct format_entry     *fe, *fe_next;
-
-       fe_next = RB_MIN(format_tree, ft);
-       while (fe_next != NULL) {
-               fe = fe_next;
-               fe_next = RB_NEXT(format_tree, ft, fe);
+       struct format_entry     *fe, *fe1;
 
-               RB_REMOVE(format_tree, ft, fe);
+       RB_FOREACH_SAFE(fe, format_rb_tree, &ft->tree, fe1) {
+               RB_REMOVE(format_rb_tree, &ft->tree, fe);
                free(fe->value);
                free(fe->key);
                free(fe);
@@ -164,7 +178,7 @@ format_add(struct format_tree *ft, const char *key, const 
char *fmt, ...)
        xvasprintf(&fe->value, fmt, ap);
        va_end(ap);
 
-       fe_now = RB_INSERT(format_tree, ft, fe);
+       fe_now = RB_INSERT(format_rb_tree, &ft->tree, fe);
        if (fe_now != NULL) {
                free(fe_now->value);
                fe_now->value = fe->value;
@@ -178,9 +192,32 @@ const char *
 format_find(struct format_tree *ft, const char *key)
 {
        struct format_entry     *fe, fe_find;
+       struct options_entry    *o;
+       static char              s[16];
+
+       o = options_find(&global_options, key);
+       if (o == NULL && ft->w != NULL)
+               o = options_find(&ft->w->options, key);
+       if (o == NULL)
+               o = options_find(&global_w_options, key);
+       if (o == NULL && ft->s != NULL)
+               o = options_find(&ft->s->options, key);
+       if (o == NULL)
+               o = options_find(&global_s_options, key);
+       if (o != NULL) {
+               switch (o->type) {
+               case OPTIONS_STRING:
+                       return (o->str);
+               case OPTIONS_NUMBER:
+                       snprintf(s, sizeof s, "%lld", o->num);
+                       return (s);
+               case OPTIONS_STYLE:
+                       return (style_tostring(&o->style));
+               }
+       }
 
        fe_find.key = (char *) key;
-       fe = RB_FIND(format_tree, ft, &fe_find);
+       fe = RB_FIND(format_rb_tree, &ft->tree, &fe_find);
        if (fe == NULL)
                return (NULL);
        return (fe->value);
@@ -205,7 +242,7 @@ format_replace(struct format_tree *ft, const char *key, 
size_t keylen,
        copy[keylen] = '\0';
 
        /* Is there a length limit or whatnot? */
-       if (!islower((u_char) *copy) && *copy != '?') {
+       if (!islower((u_char) *copy) && *copy != '@' && *copy != '?') {
                while (*copy != ':' && *copy != '\0') {
                        switch (*copy) {
                        case '=':
@@ -388,6 +425,8 @@ format_session(struct format_tree *ft, struct session *s)
        char                    *tim;
        time_t                   t;
 
+       ft->s = s;
+
        format_add(ft, "session_name", "%s", s->name);
        format_add(ft, "session_windows", "%u", winlink_count(&s->windows));
        format_add(ft, "session_width", "%u", s->sx);
@@ -417,6 +456,9 @@ format_client(struct format_tree *ft, struct client *c)
        time_t           t;
        struct session  *s;
 
+       if (ft->s == NULL)
+               ft->s = c->session;
+
        format_add(ft, "client_height", "%u", c->tty.sy);
        format_add(ft, "client_width", "%u", c->tty.sx);
        if (c->tty.path != NULL)
@@ -462,6 +504,8 @@ format_window(struct format_tree *ft, struct window *w)
 {
        char    *layout;
 
+       ft->w = w;
+
        layout = layout_dump(w);
 
        format_add(ft, "window_id", "@%u", w->id);
@@ -483,6 +527,9 @@ format_winlink(struct format_tree *ft, struct session *s, 
struct winlink *wl)
        struct window   *w = wl->window;
        char            *flags;
 
+       if (ft->w == NULL)
+               ft->w = wl->window;
+
        flags = window_printable_flags(s, wl);
 
        format_window(ft, w);
@@ -535,6 +582,9 @@ format_window_pane(struct format_tree *ft, struct 
window_pane *wp)
        u_int                    i, idx;
        char                    *cmd;
 
+       if (ft->w == NULL)
+               ft->w = wp->window;
+
        size = 0;
        for (i = 0; i < gd->hsize; i++) {
                gl = &gd->linedata[i];
diff --git a/tmux.1 b/tmux.1
index 0ff611d..949a77b 100644
--- a/tmux.1
+++ b/tmux.1
@@ -3039,12 +3039,17 @@ and
 .Ql } ,
 for example
 .Ql #{session_name} .
-Some variables also have an shorter alias such as
-.Ql #S .
+The possible variables are listed in the table below, or the name of a
+.Nm
+option may be used for an option's value.
+Some variables have a shorter alias such as
+.Ql #S ,
+and
 .Ql ##
 is replaced by a single
 .Ql # .
-Conditionals are also accepted by prefixing with
+.Pp
+Conditionals are available by prefixing with
 .Ql \&?
 and separating two alternatives with a comma;
 if the specified variable exists and is not zero, the first alternative
@@ -3055,7 +3060,15 @@ will include the string
 .Ql attached
 if the session is attached and the string
 .Ql not attached
-if it is unattached.
+if it is unattached, or
+.Ql #{?automatic-rename,yes,no}
+will include
+.Ql yes
+if
+.Ic automatic-rename
+is enabled, or
+.Ql no
+if not.
 A limit may be placed on the length of the resultant string by prefixing it
 by an
 .Ql = ,
diff --git a/tmux.h b/tmux.h
index f979a4b..d8cb5da 100644
--- a/tmux.h
+++ b/tmux.h
@@ -1461,15 +1461,6 @@ struct options_table_entry {
        const char             *style;
 };
 
-/* Tree of format entries. */
-struct format_entry {
-       char                   *key;
-       char                   *value;
-
-       RB_ENTRY(format_entry)  entry;
-};
-RB_HEAD(format_tree, format_entry);
-
 /* Common command usages. */
 #define CMD_TARGET_PANE_USAGE "[-t target-pane]"
 #define CMD_TARGET_WINDOW_USAGE "[-t target-window]"
@@ -1513,8 +1504,7 @@ void               cfg_print_causes(struct cmd_q *);
 void            cfg_show_causes(struct session *);
 
 /* format.c */
-int             format_cmp(struct format_entry *, struct format_entry *);
-RB_PROTOTYPE(format_tree, format_entry, entry, format_cmp);
+struct format_tree;
 struct format_tree *format_create(void);
 void            format_free(struct format_tree *);
 void printflike(3, 4) format_add(struct format_tree *, const char *,


commit e52d7912122177ddff952feccc192a3f357b9d1b
Author: nicm <nicm>
Commit: nicm <nicm>

    Another fix for insertion from Balazs Kezes. On insertion, size the line
    just enough for the inserted characters.
---
 grid-view.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/grid-view.c b/grid-view.c
index a34c5a0..078a0da 100644
--- a/grid-view.c
+++ b/grid-view.c
@@ -184,9 +184,10 @@ grid_view_insert_cells(struct grid *gd, u_int px, u_int 
py, u_int nx)
        px = grid_view_x(gd, px);
        py = grid_view_y(gd, py);
 
-       sx = grid_view_x(gd, gd->linedata[py].cellsize);
-       if (sx < px + nx)
-               sx = px + nx;
+       if (gd->linedata[py].cellsize + nx < gd->sx)
+               sx = grid_view_x(gd, gd->linedata[py].cellsize + nx);
+       else
+               sx = grid_view_x(gd, gd->sx);
 
        if (px == sx - 1)
                grid_clear(gd, px, py, 1, 1);


commit c8bf8ee931e4ccfe709f5ac36fb210e938eeec50
Author: nicm <nicm>
Commit: nicm <nicm>

    Check ZOOMED flag on window.
---
 format.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/format.c b/format.c
index 7299104..0f4f54c 100644
--- a/format.c
+++ b/format.c
@@ -470,6 +470,8 @@ format_window(struct format_tree *ft, struct window *w)
        format_add(ft, "window_height", "%u", w->sy);
        format_add(ft, "window_layout", "%s", layout);
        format_add(ft, "window_panes", "%u", window_count_panes(w));
+       format_add(ft, "window_zoomed_flag", "%u",
+           !!(w->flags & WINDOW_ZOOMED));
 
        free(layout);
 }
@@ -497,8 +499,6 @@ format_winlink(struct format_tree *ft, struct session *s, 
struct winlink *wl)
            !!(wl->flags & WINLINK_SILENCE));
        format_add(ft, "window_last_flag", "%u",
            !!(wl == TAILQ_FIRST(&s->lastw)));
-       format_add(ft, "window_zoomed_flag", "%u",
-           !!(wl->flags & WINDOW_ZOOMED));
 
        free(flags);
 }


commit c403bfc89488bf3867cee9d5c3b4083a3f80bee6
Author: nicm <nicm>
Commit: nicm <nicm>

    Remove dead code, from Thomas Adam.
---
 tmux.h          |    3 ---
 window-choose.c |   30 ------------------------------
 2 files changed, 0 insertions(+), 33 deletions(-)

diff --git a/tmux.h b/tmux.h
index a15bd3d..f979a4b 100644
--- a/tmux.h
+++ b/tmux.h
@@ -2236,9 +2236,6 @@ struct window_choose_data 
*window_choose_add_window(struct window_pane *,
 struct window_choose_data      *window_choose_add_session(struct window_pane *,
                        struct client *, struct session *, const char *,
                        const char *, u_int);
-struct window_choose_data      *window_choose_add_item(struct window_pane *,
-                       struct client *, struct winlink *, const char *,
-                       const char *, u_int);
 void   window_choose_expand_all(struct window_pane *);
 void   window_choose_collapse_all(struct window_pane *);
 void   window_choose_set_current(struct window_pane *, u_int);
diff --git a/window-choose.c b/window-choose.c
index db09287..5601639 100644
--- a/window-choose.c
+++ b/window-choose.c
@@ -932,36 +932,6 @@ window_choose_add_session(struct window_pane *wp, struct 
client *c,
 }
 
 struct window_choose_data *
-window_choose_add_item(struct window_pane *wp, struct client *c,
-    struct winlink *wl, const char *template, const char *action, u_int idx)
-{
-       struct window_choose_data       *wcd;
-       char                            *expanded;
-
-       wcd = window_choose_data_create(TREE_OTHER, c, c->session);
-       wcd->idx = wl->idx;
-
-       wcd->ft_template = xstrdup(template);
-       format_add(wcd->ft, "line", "%u", idx);
-       format_session(wcd->ft, wcd->start_session);
-       format_winlink(wcd->ft, wcd->start_session, wl);
-       format_window_pane(wcd->ft, wl->window->active);
-
-       /*
-        * Interpolate action here, since the data we pass back is the expanded
-        * template itself.
-        */
-       xasprintf(&expanded, "%s", format_expand(wcd->ft, wcd->ft_template));
-       wcd->command = cmd_template_replace(action, expanded, 1);
-       free(expanded);
-
-       window_choose_add(wp, wcd);
-
-       return (wcd);
-
-}
-
-struct window_choose_data *
 window_choose_add_window(struct window_pane *wp, struct client *c,
     struct session *s, struct winlink *wl, const char *template,
     const char *action, u_int idx)


commit a3612a5472ec5ecf1ffbb1c3cdea58d6b709478d
Author: millert <millert>
Commit: millert <millert>

    Prefer setvbuf() to setlinebuf() for portability; ok deraadt@
---
 log.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/log.c b/log.c
index b266d5a..0f42f66 100644
--- a/log.c
+++ b/log.c
@@ -45,7 +45,7 @@ log_open(const char *path)
        if (log_file == NULL)
                return;
 
-       setlinebuf(log_file);
+       setvbuf(log_file, NULL, _IOLBF, 0);
        event_set_log_callback(log_event_cb);
 
        tzset();


-----------------------------------------------------------------------

Summary of changes:
 cmd-if-shell.c  |   27 ++++++++++++++++--
 format.c        |   80 ++++++++++++++++++++++++++++++++++++++++++++----------
 grid-view.c     |    7 +++--
 log.c           |    2 +-
 tmux.1          |   34 +++++++++++++++++++----
 tmux.h          |   15 +---------
 window-choose.c |   30 --------------------
 7 files changed, 123 insertions(+), 72 deletions(-)


hooks/post-receive
-- 
tmux

------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
_______________________________________________
tmux-cvs mailing list
tmux-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-cvs

Reply via email to