Revision: 2805
          http://tmux.svn.sourceforge.net/tmux/?rev=2805&view=rev
Author:   tcunha
Date:     2012-05-22 21:03:25 +0000 (Tue, 22 May 2012)
Log Message:
-----------
Sync OpenBSD patchset 1119:

Switch all of the various choose- and list- commands over to the format
infrastructure, from Thomas Adam.

Modified Paths:
--------------
    trunk/cmd-break-pane.c
    trunk/cmd-choose-buffer.c
    trunk/cmd-choose-client.c
    trunk/cmd-choose-session.c
    trunk/cmd-choose-window.c
    trunk/cmd-display-message.c
    trunk/cmd-find-window.c
    trunk/cmd-list-buffers.c
    trunk/cmd-list-clients.c
    trunk/cmd-list-sessions.c
    trunk/cmd-list-windows.c
    trunk/cmd-new-window.c
    trunk/cmd-split-window.c
    trunk/format.c
    trunk/tmux.1
    trunk/tmux.h

Modified: trunk/cmd-break-pane.c
===================================================================
--- trunk/cmd-break-pane.c      2012-05-22 20:59:58 UTC (rev 2804)
+++ trunk/cmd-break-pane.c      2012-05-22 21:03:25 UTC (rev 2805)
@@ -93,9 +93,10 @@
        server_status_session_group(s);
 
        if (args_has(args, 'P')) {
-               template = "#{session_name}:#{window_index}";
-               if (args_has(args, 'F'))
-                       template = args_get(args, 'F');
+
+               if ((template = args_get(args, 'F')) == NULL)
+                       template = DEFAULT_PANE_INFO_TEMPLATE;
+
                ft = format_create();
                if ((c = cmd_find_client(ctx, NULL)) != NULL)
                        format_client(ft, c);

Modified: trunk/cmd-choose-buffer.c
===================================================================
--- trunk/cmd-choose-buffer.c   2012-05-22 20:59:58 UTC (rev 2804)
+++ trunk/cmd-choose-buffer.c   2012-05-22 21:03:25 UTC (rev 2805)
@@ -33,8 +33,8 @@
 
 const struct cmd_entry cmd_choose_buffer_entry = {
        "choose-buffer", NULL,
-       "t:", 0, 1,
-       CMD_TARGET_WINDOW_USAGE " [template]",
+       "F:t:", 0, 1,
+       CMD_TARGET_WINDOW_USAGE " [-F format] [template]",
        0,
        NULL,
        NULL,
@@ -53,14 +53,19 @@
        struct cmd_choose_buffer_data   *cdata;
        struct winlink                  *wl;
        struct paste_buffer             *pb;
+       struct format_tree              *ft;
        u_int                            idx;
-       char                            *tmp;
+       char                            *line;
+       const char                      *template;
 
        if (ctx->curclient == NULL) {
                ctx->error(ctx, "must be run interactively");
                return (-1);
        }
 
+       if ((template = args_get(args, 'F')) == NULL)
+               template = DEFAULT_BUFFER_LIST_TEMPLATE;
+
        if ((wl = cmd_find_window(ctx, args_get(args, 't'), NULL)) == NULL)
                return (-1);
 
@@ -72,10 +77,15 @@
 
        idx = 0;
        while ((pb = paste_walk_stack(&global_buffers, &idx)) != NULL) {
-               tmp = paste_print(pb, 50);
-               window_choose_add(wl->window->active, idx - 1,
-                   "%u: %zu bytes: \"%s\"", idx - 1, pb->size, tmp);
-               xfree(tmp);
+               ft = format_create();
+               format_add(ft, "line", "%u", idx - 1);
+               format_paste_buffer(ft, pb);
+
+               line = format_expand(ft, template);
+               window_choose_add(wl->window->active, idx - 1, "%s", line);
+
+               xfree(line);
+               format_free(ft);
        }
 
        cdata = xmalloc(sizeof *cdata);

Modified: trunk/cmd-choose-client.c
===================================================================
--- trunk/cmd-choose-client.c   2012-05-22 20:59:58 UTC (rev 2804)
+++ trunk/cmd-choose-client.c   2012-05-22 21:03:25 UTC (rev 2805)
@@ -33,8 +33,8 @@
 
 const struct cmd_entry cmd_choose_client_entry = {
        "choose-client", NULL,
-       "t:", 0, 1,
-       CMD_TARGET_WINDOW_USAGE " [template]",
+       "F:t:", 0, 1,
+       CMD_TARGET_WINDOW_USAGE " [-F format] [template]",
        0,
        NULL,
        NULL,
@@ -51,8 +51,11 @@
 {
        struct args                     *args = self->args;
        struct cmd_choose_client_data   *cdata;
+       struct format_tree              *ft;
        struct winlink                  *wl;
        struct client                   *c;
+       char                            *line;
+       const char                      *template;
        u_int                            i, idx, cur;
 
        if (ctx->curclient == NULL) {
@@ -66,6 +69,9 @@
        if (window_pane_set_mode(wl->window->active, &window_choose_mode) != 0)
                return (0);
 
+       if ((template = args_get(args, 'F')) == NULL)
+               template = DEFAULT_CLIENT_TEMPLATE;
+
        cur = idx = 0;
        for (i = 0; i < ARRAY_LENGTH(&clients); i++) {
                c = ARRAY_ITEM(&clients, i);
@@ -75,12 +81,16 @@
                        cur = idx;
                idx++;
 
-               window_choose_add(wl->window->active, i,
-                   "%s: %s [%ux%u %s]%s%s", c->tty.path,
-                   c->session->name, c->tty.sx, c->tty.sy,
-                   c->tty.termname,
-                   c->tty.flags & TTY_UTF8 ? " (utf8)" : "",
-                   c->flags & CLIENT_READONLY ? " (ro)" : "");
+               ft = format_create();
+               format_add(ft, "line", "%u", i);
+               format_session(ft, c->session);
+               format_client(ft, c);
+
+               line = format_expand(ft, template);
+               window_choose_add(wl->window->active, i, "%s", line);
+               xfree(line);
+
+               format_free(ft);
        }
 
        cdata = xmalloc(sizeof *cdata);

Modified: trunk/cmd-choose-session.c
===================================================================
--- trunk/cmd-choose-session.c  2012-05-22 20:59:58 UTC (rev 2804)
+++ trunk/cmd-choose-session.c  2012-05-22 21:03:25 UTC (rev 2805)
@@ -33,8 +33,8 @@
 
 const struct cmd_entry cmd_choose_session_entry = {
        "choose-session", NULL,
-       "t:", 0, 1,
-       CMD_TARGET_WINDOW_USAGE " [template]",
+       "F:t:", 0, 1,
+       CMD_TARGET_WINDOW_USAGE " [-F format] [template]",
        0,
        NULL,
        NULL,
@@ -53,9 +53,10 @@
        struct cmd_choose_session_data  *cdata;
        struct winlink                  *wl;
        struct session                  *s;
-       struct session_group            *sg;
-       u_int                            idx, sgidx, cur;
-       char                             tmp[64];
+       struct format_tree              *ft;
+       const char                      *template;
+       char                            *line;
+       u_int                            idx, cur;
 
        if (ctx->curclient == NULL) {
                ctx->error(ctx, "must be run interactively");
@@ -68,24 +69,24 @@
        if (window_pane_set_mode(wl->window->active, &window_choose_mode) != 0)
                return (0);
 
+       if ((template = args_get(args, 'F')) == NULL)
+               template = DEFAULT_SESSION_TEMPLATE;
+
        cur = idx = 0;
        RB_FOREACH(s, sessions, &sessions) {
                if (s == ctx->curclient->session)
                        cur = idx;
                idx++;
 
-               sg = session_group_find(s);
-               if (sg == NULL)
-                       *tmp = '\0';
-               else {
-                       sgidx = session_group_index(sg);
-                       xsnprintf(tmp, sizeof tmp, " (group %u)", sgidx);
-               }
+               ft = format_create();
+               format_add(ft, "line", "%u", idx);
+               format_session(ft, s);
 
-               window_choose_add(wl->window->active, s->idx,
-                   "%s: %u windows [%ux%u]%s%s", s->name,
-                   winlink_count(&s->windows), s->sx, s->sy,
-                   tmp, s->flags & SESSION_UNATTACHED ? "" : " (attached)");
+               line = format_expand(ft, template);
+               window_choose_add(wl->window->active, s->idx, "%s", line);
+               xfree(line);
+
+               format_free(ft);
        }
 
        cdata = xmalloc(sizeof *cdata);

Modified: trunk/cmd-choose-window.c
===================================================================
--- trunk/cmd-choose-window.c   2012-05-22 20:59:58 UTC (rev 2804)
+++ trunk/cmd-choose-window.c   2012-05-22 21:03:25 UTC (rev 2805)
@@ -33,8 +33,8 @@
 
 const struct cmd_entry cmd_choose_window_entry = {
        "choose-window", NULL,
-       "t:", 0, 1,
-       CMD_TARGET_WINDOW_USAGE " [template]",
+       "F:t:", 0, 1,
+       CMD_TARGET_WINDOW_USAGE " [-F format] [template]",
        0,
        NULL,
        NULL,
@@ -54,10 +54,10 @@
        struct cmd_choose_window_data   *cdata;
        struct session                  *s;
        struct winlink                  *wl, *wm;
-       struct window                   *w;
+       struct format_tree              *ft;
+       const char                      *template;
+       char                            *line;
        u_int                            idx, cur;
-       char                            *flags, *title;
-       const char                      *left, *right;
 
        if (ctx->curclient == NULL) {
                ctx->error(ctx, "must be run interactively");
@@ -71,30 +71,25 @@
        if (window_pane_set_mode(wl->window->active, &window_choose_mode) != 0)
                return (0);
 
+       if ((template = args_get(args, 'F')) == NULL)
+               template = DEFAULT_WINDOW_TEMPLATE;
+
        cur = idx = 0;
        RB_FOREACH(wm, winlinks, &s->windows) {
-               w = wm->window;
-
                if (wm == s->curw)
                        cur = idx;
                idx++;
 
-               flags = window_printable_flags(s, wm);
-               title = w->active->screen->title;
-               if (wm == wl)
-                       title = w->active->base.title;
-               left = " \"";
-               right = "\"";
-               if (*title == '\0')
-                       left = right = "";
+               ft = format_create();
+               format_add(ft, "line", "%u", idx);
+               format_session(ft, s);
+               format_winlink(ft, s, wm);
 
-               window_choose_add(wl->window->active,
-                   wm->idx, "%3d: %s%s [%ux%u] (%u panes%s)%s%s%s",
-                   wm->idx, w->name, flags, w->sx, w->sy, 
window_count_panes(w),
-                   w->active->fd == -1 ? ", dead" : "",
-                   left, title, right);
+               line = format_expand(ft, template);
+               window_choose_add(wl->window->active, idx, "%s", line);
 
-               xfree(flags);
+               xfree(line);
+               format_free(ft);
        }
 
        cdata = xmalloc(sizeof *cdata);

Modified: trunk/cmd-display-message.c
===================================================================
--- trunk/cmd-display-message.c 2012-05-22 20:59:58 UTC (rev 2804)
+++ trunk/cmd-display-message.c 2012-05-22 21:03:25 UTC (rev 2805)
@@ -75,7 +75,7 @@
        if (args->argc != 0)
                template = args->argv[0];
        if (template == NULL)
-               template = "[#S] #I:#W, current pane #P - (%H:%M %d-%b-%y)";
+               template = DEFAULT_DISPLAY_MESSAGE_TEMPLATE;
 
        ft = format_create();
        format_client(ft, c);

Modified: trunk/cmd-find-window.c
===================================================================
--- trunk/cmd-find-window.c     2012-05-22 20:59:58 UTC (rev 2804)
+++ trunk/cmd-find-window.c     2012-05-22 21:03:25 UTC (rev 2805)
@@ -46,8 +46,8 @@
 
 const struct cmd_entry cmd_find_window_entry = {
        "find-window", "findw",
-       "CNt:T", 1, 4,
-       "[-CNT] " CMD_TARGET_WINDOW_USAGE " match-string",
+       "F:CNt:T", 1, 4,
+       "[-CNT] [-F format] " CMD_TARGET_WINDOW_USAGE " match-string",
        0,
        NULL,
        NULL,
@@ -85,11 +85,13 @@
        struct cmd_find_window_data     *cdata;
        struct session                  *s;
        struct winlink                  *wl, *wm;
-       struct window                   *w;
        struct window_pane              *wp;
+       struct format_tree              *ft;
        ARRAY_DECL(, u_int)              list_idx;
        ARRAY_DECL(, char *)             list_ctx;
        char                            *str, *sres, *sctx, *searchstr;
+       char                            *find_line;
+       const char                      *template;
        u_int                            i, line, match_flags;
 
        if (ctx->curclient == NULL) {
@@ -101,6 +103,9 @@
        if ((wl = cmd_find_window(ctx, args_get(args, 't'), NULL)) == NULL)
                return (-1);
 
+       if ((template = args_get(args, 'F')) == NULL)
+               template = DEFAULT_FIND_WINDOW_TEMPLATE;
+
        match_flags = cmd_find_window_match_flags(args);
        str = args->argv[0];
 
@@ -167,13 +172,20 @@
        for (i = 0; i < ARRAY_LENGTH(&list_idx); i++) {
                wm = winlink_find_by_index(
                    &s->windows, ARRAY_ITEM(&list_idx, i));
-               w = wm->window;
 
-               sctx = ARRAY_ITEM(&list_ctx, i);
-               window_choose_add(wl->window->active,
-                   wm->idx, "%3d: %s [%ux%u] (%u panes) %s", wm->idx, w->name,
-                   w->sx, w->sy, window_count_panes(w), sctx);
-               xfree(sctx);
+               ft = format_create();
+               format_add(ft, "line", "%u", i);
+               format_add(ft, "window_find_matches", "%s",
+                       ARRAY_ITEM(&list_ctx, i));
+               format_session(ft, s);
+               format_winlink(ft, s, wm);
+
+               find_line = format_expand(ft, template);
+
+               window_choose_add(wl->window->active, wm->idx, "%s", find_line);
+
+               xfree(find_line);
+               format_free(ft);
        }
 
        cdata = xmalloc(sizeof *cdata);

Modified: trunk/cmd-list-buffers.c
===================================================================
--- trunk/cmd-list-buffers.c    2012-05-22 20:59:58 UTC (rev 2804)
+++ trunk/cmd-list-buffers.c    2012-05-22 21:03:25 UTC (rev 2805)
@@ -30,8 +30,8 @@
 
 const struct cmd_entry cmd_list_buffers_entry = {
        "list-buffers", "lsb",
-       "", 0, 0,
-       "",
+       "F:", 0, 0,
+       "[-F format]",
        0,
        NULL,
        NULL,
@@ -42,16 +42,27 @@
 int
 cmd_list_buffers_exec(unused struct cmd *self, struct cmd_ctx *ctx)
 {
+       struct args             *args = self->args;
        struct paste_buffer     *pb;
+       struct format_tree      *ft;
        u_int                    idx;
-       char                    *tmp;
+       char                    *line;
+       const char              *template;
 
+       if ((template = args_get(args, 'F')) == NULL)
+               template = DEFAULT_BUFFER_LIST_TEMPLATE;
+
        idx = 0;
        while ((pb = paste_walk_stack(&global_buffers, &idx)) != NULL) {
-               tmp = paste_print(pb, 50);
-               ctx->print(ctx,
-                   "%u: %zu bytes: \"%s\"", idx - 1, pb->size, tmp);
-               xfree(tmp);
+               ft = format_create();
+               format_add(ft, "line", "%u", idx - 1);
+               format_paste_buffer(ft, pb);
+
+               line = format_expand(ft, template);
+               ctx->print(ctx, "%s", line);
+               xfree(line);
+
+               format_free(ft);
        }
 
        return (0);

Modified: trunk/cmd-list-clients.c
===================================================================
--- trunk/cmd-list-clients.c    2012-05-22 20:59:58 UTC (rev 2804)
+++ trunk/cmd-list-clients.c    2012-05-22 21:03:25 UTC (rev 2805)
@@ -58,13 +58,8 @@
        } else
                s = NULL;
 
-       template = args_get(args, 'F');
-       if (template == NULL) {
-               template = "#{client_tty}: #{session_name} "
-                   "[#{client_width}x#{client_height} #{client_termname}]"
-                   "#{?client_utf8, (utf8),}"
-                   "#{?client_readonly, (ro),}";
-       }
+       if ((template = args_get(args, 'F')) == NULL)
+               template = DEFAULT_CLIENT_TEMPLATE;
 
        for (i = 0; i < ARRAY_LENGTH(&clients); i++) {
                c = ARRAY_ITEM(&clients, i);

Modified: trunk/cmd-list-sessions.c
===================================================================
--- trunk/cmd-list-sessions.c   2012-05-22 20:59:58 UTC (rev 2804)
+++ trunk/cmd-list-sessions.c   2012-05-22 21:03:25 UTC (rev 2805)
@@ -49,14 +49,8 @@
        const char              *template;
        char                    *line;
 
-       template = args_get(args, 'F');
-       if (template == NULL) {
-               template = "#{session_name}: #{session_windows} windows "
-                   "(created #{session_created_string}) [#{session_width}x"
-                   "#{session_height}]#{?session_grouped, (group ,}"
-                   "#{session_group}#{?session_grouped,),}"
-                   "#{?session_attached, (attached),}";
-       }
+       if ((template = args_get(args, 'F')) == NULL)
+               template = DEFAULT_SESSION_TEMPLATE;
 
        n = 0;
        RB_FOREACH(s, sessions, &sessions) {

Modified: trunk/cmd-list-windows.c
===================================================================
--- trunk/cmd-list-windows.c    2012-05-22 20:59:58 UTC (rev 2804)
+++ trunk/cmd-list-windows.c    2012-05-22 21:03:25 UTC (rev 2805)
@@ -34,7 +34,7 @@
 
 const struct cmd_entry cmd_list_windows_entry = {
        "list-windows", "lsw",
-       "aF:t:", 0, 0,
+       "F:at:", 0, 0,
        "[-a] [-F format] " CMD_TARGET_SESSION_USAGE,
        0,
        NULL,
@@ -84,18 +84,10 @@
        if (template == NULL) {
                switch (type) {
                case 0:
-                       template = "#{window_index}: "
-                           "#{window_name} "
-                           "[#{window_width}x#{window_height}] "
-                           "[layout #{window_layout}] #{window_id}"
-                           "#{?window_active, (active),}";
+                       template = DEFAULT_WINDOW_TEMPLATE;
                        break;
                case 1:
-                       template = "#{session_name}:#{window_index}: "
-                           "#{window_name} "
-                           "[#{window_width}x#{window_height}] "
-                           "[layout #{window_layout}] #{window_id}"
-                           "#{?window_active, (active),}";
+                       template = "#{session_name}:" DEFAULT_WINDOW_TEMPLATE;
                        break;
                }
        }

Modified: trunk/cmd-new-window.c
===================================================================
--- trunk/cmd-new-window.c      2012-05-22 20:59:58 UTC (rev 2804)
+++ trunk/cmd-new-window.c      2012-05-22 21:03:25 UTC (rev 2805)
@@ -122,15 +122,15 @@
                server_status_session_group(s);
 
        if (args_has(args, 'P')) {
-               template = "#{session_name}:#{window_index}";
-               if (args_has(args, 'F'))
-                       template = args_get(args, 'F');
+               if ((template = args_get(args, 'F')) == NULL)
+                       template = DEFAULT_PANE_INFO_TEMPLATE;
 
                ft = format_create();
                if ((c = cmd_find_client(ctx, NULL)) != NULL)
                    format_client(ft, c);
                format_session(ft, s);
                format_winlink(ft, s, wl);
+               format_window_pane(ft, wl->window->active);
 
                cp = format_expand(ft, template);
                ctx->print(ctx, "%s", cp);

Modified: trunk/cmd-split-window.c
===================================================================
--- trunk/cmd-split-window.c    2012-05-22 20:59:58 UTC (rev 2804)
+++ trunk/cmd-split-window.c    2012-05-22 21:03:25 UTC (rev 2805)
@@ -138,9 +138,8 @@
        environ_free(&env);
 
        if (args_has(args, 'P')) {
-               template = "#{session_name}:#{window_index}.#{pane_index}";
-               if (args_has(args, 'F'))
-                       template = args_get(args, 'F');
+               if ((template = args_get(args, 'F')) == NULL)
+                       template = DEFAULT_PANE_INFO_TEMPLATE;
 
                ft = format_create();
                if ((c = cmd_find_client(ctx, NULL)) != NULL)

Modified: trunk/format.c
===================================================================
--- trunk/format.c      2012-05-22 20:59:58 UTC (rev 2804)
+++ trunk/format.c      2012-05-22 21:03:25 UTC (rev 2805)
@@ -349,6 +349,7 @@
        format_add(ft, "window_flags", "%s", flags);
        format_add(ft, "window_layout", "%s", layout);
        format_add(ft, "window_active", "%d", wl == s->curw);
+       format_add(ft, "window_panes", "%u", window_count_panes(w));
 
        xfree(flags);
        xfree(layout);
@@ -393,3 +394,14 @@
        format_add(ft, "pane_pid", "%ld", (long) wp->pid);
        format_add(ft, "pane_tty", "%s", wp->tty);
 }
+
+void
+format_paste_buffer(struct format_tree *ft, struct paste_buffer *pb)
+{
+       char    *pb_print = paste_print(pb, 50);
+
+       format_add(ft, "buffer_size", "%zu", pb->size);
+       format_add(ft, "buffer_sample", "%s", pb_print);
+
+       xfree(pb_print);
+}

Modified: trunk/tmux.1
===================================================================
--- trunk/tmux.1        2012-05-22 20:59:58 UTC (rev 2804)
+++ trunk/tmux.1        2012-05-22 21:03:25 UTC (rev 2805)
@@ -1037,6 +1037,7 @@
 The default is to capture only the visible contents of the pane.
 .It Xo
 .Ic choose-client
+.Op Fl F Ar format
 .Op Fl t Ar target-window
 .Op Ar template
 .Xc
@@ -1052,10 +1053,16 @@
 If
 .Ar template
 is not given, "detach-client -t '%%'" is used.
+For the meaning of the
+.Fl F
+flag, see the
+.Sx FORMATS
+section.
 This command works only from inside
 .Nm .
 .It Xo
 .Ic choose-session
+.Op Fl F Ar format
 .Op Fl t Ar target-window
 .Op Ar template
 .Xc
@@ -1069,10 +1076,16 @@
 If
 .Ar template
 is not given, "switch-client -t '%%'" is used.
+For the meaning of the
+.Fl F
+flag, see the
+.Sx FORMATS
+section.
 This command works only from inside
 .Nm .
 .It Xo
 .Ic choose-window
+.Op Fl F Ar format
 .Op Fl t Ar target-window
 .Op Ar template
 .Xc
@@ -1086,6 +1099,11 @@
 If
 .Ar template
 is not given, "select-window -t '%%'" is used.
+For the meaning of the
+.Fl F
+flag, see the
+.Sx FORMATS
+section.
 This command works only from inside
 .Nm .
 .It Ic display-panes Op Fl t Ar target-client
@@ -1105,6 +1123,7 @@
 keys.
 .It Xo Ic find-window
 .Op Fl CNT
+.Op Fl F Ar format
 .Op Fl t Ar target-window
 .Ar match-string
 .Xc
@@ -1125,6 +1144,11 @@
 .Fl CNT .
 If only one window is matched, it'll be automatically selected,
 otherwise a choice list is shown.
+For the meaning of the
+.Fl F
+flag, see the
+.Sx FORMATS
+section.
 This command only works from inside
 .Nm .
 .It Xo Ic join-pane
@@ -2765,13 +2789,7 @@
 is used.
 .El
 .Sh FORMATS
-The
-.Ic list-clients ,
-.Ic list-sessions ,
-.Ic list-windows
-and
-.Ic list-panes
-commands accept the
+Certain commands accept the
 .Fl F
 flag with a
 .Ar format
@@ -2804,6 +2822,8 @@
 The following variables are available, where appropriate:
 .Bl -column "session_created_string" "Replaced with" -offset indent
 .It Sy "Variable name" Ta Sy "Replaced with"
+.It Li "buffer_sample" Ta "First 50 characters from the specified buffer"
+.It Li "buffer_size" Ta "Size of the specified buffer in bytes"
 .It Li "client_activity" Ta "Integer time client last had activity"
 .It Li "client_activity_string" Ta "String time client last had activity"
 .It Li "client_created" Ta "Integer time client created"
@@ -2838,11 +2858,13 @@
 .It Li "session_width" Ta "Width of session"
 .It Li "session_windows" Ta "Number of windows in session"
 .It Li "window_active" Ta "1 if window active"
+.It Li "window_find_matches" Ta "Matched data from the find-window command if 
available"
 .It Li "window_flags" Ta "Window flags"
 .It Li "window_height" Ta "Height of window"
 .It Li "window_index" Ta "Index of window"
 .It Li "window_layout" Ta "Window layout description"
 .It Li "window_name" Ta "Name of window"
+.It Li "window_panes" Ta "Number of panes in window"
 .It Li "window_width" Ta "Width of window"
 .El
 .Sh NAMES AND TITLES
@@ -3149,6 +3171,7 @@
 .Bl -tag -width Ds
 .It Xo
 .Ic choose-buffer
+.Op Fl F Ar format
 .Op Fl t Ar target-window
 .Op Ar template
 .Xc
@@ -3162,6 +3185,11 @@
 If
 .Ar template
 is not given, "paste-buffer -b '%%'" is used.
+For the meaning of the
+.Fl F
+flag, see the
+.Sx FORMATS
+section.
 This command works only from inside
 .Nm .
 .It Ic clear-history Op Fl t Ar target-pane
@@ -3172,9 +3200,16 @@
 Delete the buffer at
 .Ar buffer-index ,
 or the top buffer if not specified.
-.It Ic list-buffers
+.It Xo Ic list-buffers
+.Op Fl F Ar format
+.Xc
 .D1 (alias: Ic lsb )
 List the global buffers.
+For the meaning of the
+.Fl F
+flag, see the
+.Sx FORMATS
+section.
 .It Xo Ic load-buffer
 .Op Fl b Ar buffer-index
 .Ar path

Modified: trunk/tmux.h
===================================================================
--- trunk/tmux.h        2012-05-22 20:59:58 UTC (rev 2804)
+++ trunk/tmux.h        2012-05-22 21:03:25 UTC (rev 2805)
@@ -88,6 +88,37 @@
 #define nitems(_a) (sizeof((_a)) / sizeof((_a)[0]))
 #endif
 
+/* Default format templates. */
+#define DEFAULT_BUFFER_LIST_TEMPLATE                           \
+       "#{line}: #{buffer_size} bytes: \"#{buffer_sample}\""
+#define DEFAULT_CLIENT_TEMPLATE                                        \
+       "#{client_tty}: #{session_name} "                       \
+       "[#client_width}x#{client_height} #{client_termname}]"  \
+       "{?client_utf8, (utf8),} #{?client_readonly, (ro),}"
+#define DEFAULT_DISPLAY_MESSAGE_TEMPLATE                       \
+       "[#{session_name}] #{window_index}:"                    \
+       "#{window_name}, current pane #{pane_index} "           \
+       "- (%H:%M %d-%b-%y)"
+#define DEFAULT_FIND_WINDOW_TEMPLATE                           \
+       "#{window_index}: #{window_name} "                      \
+       "[#{window_width}x#{window_height}] "                   \
+       "(#{window_panes} panes) #{window_find_matches}"
+#define DEFAULT_SESSION_TEMPLATE \
+       "#{session_name}: #{session_windows} windows "          \
+       "(created #{session_created_string}) "                  \
+       "[#{session_width}x#{session_height}]"                  \
+       "#{?session_grouped, (group ,}"                         \
+       "#{session_group}#{?session_grouped,),}"                \
+       "#{?session_attached, (attached),}"
+#define DEFAULT_WINDOW_TEMPLATE                                        \
+       "#{window_index}: #{window_name}#{window_flags} "       \
+       "(#{window_panes} panes) "                              \
+       "[#{window_width}x#{window_height}] "                   \
+       "[layout #{window_layout}] #{window_id}"                \
+       "#{?window_active, (active),}"
+#define DEFAULT_PANE_INFO_TEMPLATE                             \
+       "#{session_name}:#{window_index}.#{pane_index}"
+
 /* Bell option values. */
 #define BELL_NONE 0
 #define BELL_ANY 1
@@ -1402,6 +1433,7 @@
 void            format_winlink(
                     struct format_tree *, struct session *, struct winlink *);
 void            format_window_pane(struct format_tree *, struct window_pane *);
+void            format_paste_buffer(struct format_tree *, struct paste_buffer 
*);
 
 /* mode-key.c */
 extern const struct mode_key_table mode_key_tables[];

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
tmux-cvs mailing list
tmux-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-cvs

Reply via email to