From ebf94bc9cba6c41074fdfa1d1084ad5fff43fc24 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Tue, 22 May 2012 11:35:37 +0000 Subject: Switch all of the various choose- and list- commands over to the format infrastructure, from Thomas Adam. --- cmd-break-pane.c | 7 ++++--- cmd-choose-buffer.c | 24 +++++++++++++++++------- cmd-choose-client.c | 26 ++++++++++++++++++-------- cmd-choose-session.c | 33 +++++++++++++++++---------------- cmd-choose-window.c | 41 ++++++++++++++++++----------------------- cmd-display-message.c | 2 +- cmd-find-window.c | 30 +++++++++++++++++++++--------- cmd-list-buffers.c | 25 ++++++++++++++++++------- cmd-list-clients.c | 9 ++------- cmd-list-sessions.c | 10 ++-------- cmd-list-windows.c | 14 +++----------- cmd-new-window.c | 6 +++--- cmd-split-window.c | 5 ++--- format.c | 12 ++++++++++++ tmux.1 | 51 +++++++++++++++++++++++++++++++++++++++++++-------- tmux.h | 32 ++++++++++++++++++++++++++++++++ 16 files changed, 213 insertions(+), 114 deletions(-) diff --git a/cmd-break-pane.c b/cmd-break-pane.c index 6e6ab589..8e09774b 100644 --- a/cmd-break-pane.c +++ b/cmd-break-pane.c @@ -93,9 +93,10 @@ cmd_break_pane_exec(struct cmd *self, struct cmd_ctx *ctx) 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); diff --git a/cmd-choose-buffer.c b/cmd-choose-buffer.c index c1093f92..9045d9eb 100644 --- a/cmd-choose-buffer.c +++ b/cmd-choose-buffer.c @@ -33,8 +33,8 @@ void cmd_choose_buffer_free(void *); 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 @@ cmd_choose_buffer_exec(struct cmd *self, struct cmd_ctx *ctx) 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 @@ cmd_choose_buffer_exec(struct cmd *self, struct cmd_ctx *ctx) 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); diff --git a/cmd-choose-client.c b/cmd-choose-client.c index 6ad1b495..ba7508d7 100644 --- a/cmd-choose-client.c +++ b/cmd-choose-client.c @@ -33,8 +33,8 @@ void cmd_choose_client_free(void *); 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 @@ cmd_choose_client_exec(struct cmd *self, struct cmd_ctx *ctx) { 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 @@ cmd_choose_client_exec(struct cmd *self, struct cmd_ctx *ctx) 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 @@ cmd_choose_client_exec(struct cmd *self, struct cmd_ctx *ctx) 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); diff --git a/cmd-choose-session.c b/cmd-choose-session.c index 5aa0877b..ad13b151 100644 --- a/cmd-choose-session.c +++ b/cmd-choose-session.c @@ -33,8 +33,8 @@ void cmd_choose_session_free(void *); 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 @@ cmd_choose_session_exec(struct cmd *self, struct cmd_ctx *ctx) 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 @@ cmd_choose_session_exec(struct cmd *self, struct cmd_ctx *ctx) 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); + + line = format_expand(ft, template); + window_choose_add(wl->window->active, s->idx, "%s", line); + xfree(line); - 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)"); + format_free(ft); } cdata = xmalloc(sizeof *cdata); diff --git a/cmd-choose-window.c b/cmd-choose-window.c index a1280927..ba70fcd1 100644 --- a/cmd-choose-window.c +++ b/cmd-choose-window.c @@ -33,8 +33,8 @@ void cmd_choose_window_free(void *); 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 @@ cmd_choose_window_exec(struct cmd *self, struct cmd_ctx *ctx) 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 @@ cmd_choose_window_exec(struct cmd *self, struct cmd_ctx *ctx) 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 = ""; - - 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); - - xfree(flags); + ft = format_create(); + format_add(ft, "line", "%u", idx); + format_session(ft, s); + format_winlink(ft, s, wm); + + line = format_expand(ft, template); + window_choose_add(wl->window->active, idx, "%s", line); + + xfree(line); + format_free(ft); } cdata = xmalloc(sizeof *cdata); diff --git a/cmd-display-message.c b/cmd-display-message.c index d8b623b9..058de1fa 100644 --- a/cmd-display-message.c +++ b/cmd-display-message.c @@ -75,7 +75,7 @@ cmd_display_message_exec(struct cmd *self, struct cmd_ctx *ctx) 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); diff --git a/cmd-find-window.c b/cmd-find-window.c index 3ac3c68b..2d6c942f 100644 --- a/cmd-find-window.c +++ b/cmd-find-window.c @@ -46,8 +46,8 @@ void cmd_find_window_free(void *); 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 @@ cmd_find_window_exec(struct cmd *self, struct cmd_ctx *ctx) 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 @@ cmd_find_window_exec(struct cmd *self, struct cmd_ctx *ctx) 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 @@ cmd_find_window_exec(struct cmd *self, struct cmd_ctx *ctx) 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); diff --git a/cmd-list-buffers.c b/cmd-list-buffers.c index d4ff9a22..777a6371 100644 --- a/cmd-list-buffers.c +++ b/cmd-list-buffers.c @@ -30,8 +30,8 @@ int cmd_list_buffers_exec(struct cmd *, struct cmd_ctx *); 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 @@ const struct cmd_entry cmd_list_buffers_entry = { 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); diff --git a/cmd-list-clients.c b/cmd-list-clients.c index 04d756b5..c818fd6d 100644 --- a/cmd-list-clients.c +++ b/cmd-list-clients.c @@ -58,13 +58,8 @@ cmd_list_clients_exec(struct cmd *self, struct cmd_ctx *ctx) } 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); diff --git a/cmd-list-sessions.c b/cmd-list-sessions.c index 10e6b16d..7dabfc08 100644 --- a/cmd-list-sessions.c +++ b/cmd-list-sessions.c @@ -49,14 +49,8 @@ cmd_list_sessions_exec(struct cmd *self, struct cmd_ctx *ctx) 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) { diff --git a/cmd-list-windows.c b/cmd-list-windows.c index 3919bfbe..103931d2 100644 --- a/cmd-list-windows.c +++ b/cmd-list-windows.c @@ -34,7 +34,7 @@ void cmd_list_windows_session( 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 @@ cmd_list_windows_session( 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; } } diff --git a/cmd-new-window.c b/cmd-new-window.c index 5051ab1a..46bda8fc 100644 --- a/cmd-new-window.c +++ b/cmd-new-window.c @@ -122,15 +122,15 @@ cmd_new_window_exec(struct cmd *self, struct cmd_ctx *ctx) 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); diff --git a/cmd-split-window.c b/cmd-split-window.c index 5123942e..db00a67b 100644 --- a/cmd-split-window.c +++ b/cmd-split-window.c @@ -139,9 +139,8 @@ cmd_split_window_exec(struct cmd *self, struct cmd_ctx *ctx) 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) diff --git a/format.c b/format.c index 5403f170..8fe4acf4 100644 --- a/format.c +++ b/format.c @@ -349,6 +349,7 @@ format_winlink(struct format_tree *ft, struct session *s, struct winlink *wl) 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_window_pane(struct format_tree *ft, struct window_pane *wp) 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); +} diff --git a/tmux.1 b/tmux.1 index 96742378..4fad6147 100644 --- a/tmux.1 +++ b/tmux.1 @@ -1033,6 +1033,7 @@ visible pane and negative numbers are lines in the history. 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 @@ -1048,10 +1049,16 @@ and the result executed as a command. 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 @@ -1065,10 +1072,16 @@ and the result executed as a command. 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 @@ -1082,6 +1095,11 @@ and the result executed as a command. 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 @@ -1101,6 +1119,7 @@ to keys. .It Xo Ic find-window .Op Fl CNT +.Op Fl F Ar format .Op Fl t Ar target-window .Ar match-string .Xc @@ -1121,6 +1140,11 @@ The default is .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 @@ -2761,13 +2785,7 @@ or the global window options if 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 @@ -2800,6 +2818,8 @@ if it is unattached. 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" @@ -2834,11 +2854,13 @@ The following variables are available, where appropriate: .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 @@ -3145,6 +3167,7 @@ The buffer commands are as follows: .Bl -tag -width Ds .It Xo .Ic choose-buffer +.Op Fl F Ar format .Op Fl t Ar target-window .Op Ar template .Xc @@ -3158,6 +3181,11 @@ and the result executed as a command. 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 @@ -3168,9 +3196,16 @@ Remove and free the history for the specified pane. 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 diff --git a/tmux.h b/tmux.h index 6c88fac1..721bef1b 100644 --- a/tmux.h +++ b/tmux.h @@ -92,6 +92,37 @@ extern char **environ; #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 @@ -1406,6 +1437,7 @@ void format_client(struct format_tree *, struct client *); 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[]; -- cgit v1.2.3