Revision: 2861 http://tmux.svn.sourceforge.net/tmux/?rev=2861&view=rev Author: tcunha Date: 2012-08-31 09:18:50 +0000 (Fri, 31 Aug 2012) Log Message: ----------- Sync OpenBSD patchset 1162:
Use a separate define for each default format template and strip clutter from the choose-tree defaults. Modified Paths: -------------- trunk/cmd-break-pane.c trunk/cmd-choose-buffer.c trunk/cmd-choose-client.c trunk/cmd-choose-tree.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/tmux.h Modified: trunk/cmd-break-pane.c =================================================================== --- trunk/cmd-break-pane.c 2012-08-14 09:38:34 UTC (rev 2860) +++ trunk/cmd-break-pane.c 2012-08-31 09:18:50 UTC (rev 2861) @@ -95,7 +95,7 @@ if (args_has(args, 'P')) { if ((template = args_get(args, 'F')) == NULL) - template = DEFAULT_PANE_INFO_TEMPLATE; + template = BREAK_PANE_TEMPLATE; ft = format_create(); if ((c = cmd_find_client(ctx, NULL)) != NULL) Modified: trunk/cmd-choose-buffer.c =================================================================== --- trunk/cmd-choose-buffer.c 2012-08-14 09:38:34 UTC (rev 2860) +++ trunk/cmd-choose-buffer.c 2012-08-31 09:18:50 UTC (rev 2861) @@ -59,7 +59,7 @@ } if ((template = args_get(args, 'F')) == NULL) - template = DEFAULT_BUFFER_LIST_TEMPLATE; + template = CHOOSE_BUFFER_TEMPLATE; if ((wl = cmd_find_window(ctx, args_get(args, 't'), NULL)) == NULL) return (CMD_RETURN_ERROR); Modified: trunk/cmd-choose-client.c =================================================================== --- trunk/cmd-choose-client.c 2012-08-14 09:38:34 UTC (rev 2860) +++ trunk/cmd-choose-client.c 2012-08-31 09:18:50 UTC (rev 2861) @@ -70,7 +70,7 @@ return (CMD_RETURN_NORMAL); if ((template = args_get(args, 'F')) == NULL) - template = DEFAULT_CLIENT_TEMPLATE; + template = CHOOSE_CLIENT_TEMPLATE; if (args->argc != 0) action = xstrdup(args->argv[0]); Modified: trunk/cmd-choose-tree.c =================================================================== --- trunk/cmd-choose-tree.c 2012-08-14 09:38:34 UTC (rev 2860) +++ trunk/cmd-choose-tree.c 2012-08-31 09:18:50 UTC (rev 2861) @@ -27,8 +27,6 @@ #define CMD_CHOOSE_TREE_WINDOW_ACTION "select-window -t '%%'" #define CMD_CHOOSE_TREE_SESSION_ACTION "switch-client -t '%%'" -#define CMD_CHOOSE_TREE_WINDOW_TEMPLATE \ - DEFAULT_WINDOW_TEMPLATE " \"#{pane_title}\"" /* * Enter choice mode to choose a session and/or window. @@ -104,7 +102,7 @@ if (self->entry == &cmd_choose_session_entry) { sflag = 1; if ((ses_template = args_get(args, 'F')) == NULL) - ses_template = DEFAULT_SESSION_TEMPLATE; + ses_template = CHOOSE_TREE_SESSION_TEMPLATE; if (args->argc != 0) ses_action = args->argv[0]; @@ -113,7 +111,7 @@ } else if (self->entry == &cmd_choose_window_entry) { wflag = 1; if ((win_template = args_get(args, 'F')) == NULL) - win_template = CMD_CHOOSE_TREE_WINDOW_TEMPLATE; + win_template = CHOOSE_TREE_WINDOW_TEMPLATE; if (args->argc != 0) win_action = args->argv[0]; @@ -130,10 +128,10 @@ win_action = CMD_CHOOSE_TREE_WINDOW_ACTION; if ((ses_template = args_get(args, 'S')) == NULL) - ses_template = DEFAULT_SESSION_TEMPLATE; + ses_template = CHOOSE_TREE_SESSION_TEMPLATE; if ((win_template = args_get(args, 'W')) == NULL) - win_template = CMD_CHOOSE_TREE_WINDOW_TEMPLATE; + win_template = CHOOSE_TREE_WINDOW_TEMPLATE; } /* Modified: trunk/cmd-display-message.c =================================================================== --- trunk/cmd-display-message.c 2012-08-14 09:38:34 UTC (rev 2860) +++ trunk/cmd-display-message.c 2012-08-31 09:18:50 UTC (rev 2861) @@ -76,7 +76,7 @@ if (args->argc != 0) template = args->argv[0]; if (template == NULL) - template = DEFAULT_DISPLAY_MESSAGE_TEMPLATE; + template = DISPLAY_MESSAGE_TEMPLATE; ft = format_create(); format_client(ft, c); Modified: trunk/cmd-find-window.c =================================================================== --- trunk/cmd-find-window.c 2012-08-14 09:38:34 UTC (rev 2860) +++ trunk/cmd-find-window.c 2012-08-31 09:18:50 UTC (rev 2861) @@ -98,7 +98,7 @@ return (CMD_RETURN_ERROR); if ((template = args_get(args, 'F')) == NULL) - template = DEFAULT_FIND_WINDOW_TEMPLATE; + template = FIND_WINDOW_TEMPLATE; match_flags = cmd_find_window_match_flags(args); str = args->argv[0]; Modified: trunk/cmd-list-buffers.c =================================================================== --- trunk/cmd-list-buffers.c 2012-08-14 09:38:34 UTC (rev 2860) +++ trunk/cmd-list-buffers.c 2012-08-31 09:18:50 UTC (rev 2861) @@ -51,7 +51,7 @@ const char *template; if ((template = args_get(args, 'F')) == NULL) - template = DEFAULT_BUFFER_LIST_TEMPLATE; + template = LIST_BUFFERS_TEMPLATE; idx = 0; while ((pb = paste_walk_stack(&global_buffers, &idx)) != NULL) { Modified: trunk/cmd-list-clients.c =================================================================== --- trunk/cmd-list-clients.c 2012-08-14 09:38:34 UTC (rev 2860) +++ trunk/cmd-list-clients.c 2012-08-31 09:18:50 UTC (rev 2861) @@ -60,7 +60,7 @@ s = NULL; if ((template = args_get(args, 'F')) == NULL) - template = DEFAULT_CLIENT_TEMPLATE; + template = LIST_CLIENTS_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-08-14 09:38:34 UTC (rev 2860) +++ trunk/cmd-list-sessions.c 2012-08-31 09:18:50 UTC (rev 2861) @@ -51,7 +51,7 @@ char *line; if ((template = args_get(args, 'F')) == NULL) - template = DEFAULT_SESSION_TEMPLATE; + template = LIST_SESSIONS_TEMPLATE; n = 0; RB_FOREACH(s, sessions, &sessions) { Modified: trunk/cmd-list-windows.c =================================================================== --- trunk/cmd-list-windows.c 2012-08-14 09:38:34 UTC (rev 2860) +++ trunk/cmd-list-windows.c 2012-08-31 09:18:50 UTC (rev 2861) @@ -85,12 +85,10 @@ if (template == NULL) { switch (type) { case 0: - template = DEFAULT_WINDOW_TEMPLATE \ - " [layout #{window_layout}] #{window_id}" \ - "#{?window_active, (active),}"; + template = LIST_WINDOWS_TEMPLATE; break; case 1: - template = "#{session_name}:" DEFAULT_WINDOW_TEMPLATE; + template = LIST_WINDOWS_WITH_SESSION_TEMPLATE; break; } } Modified: trunk/cmd-new-window.c =================================================================== --- trunk/cmd-new-window.c 2012-08-14 09:38:34 UTC (rev 2860) +++ trunk/cmd-new-window.c 2012-08-31 09:18:50 UTC (rev 2861) @@ -123,7 +123,7 @@ if (args_has(args, 'P')) { if ((template = args_get(args, 'F')) == NULL) - template = DEFAULT_PANE_INFO_TEMPLATE; + template = NEW_WINDOW_TEMPLATE; ft = format_create(); if ((c = cmd_find_client(ctx, NULL)) != NULL) Modified: trunk/cmd-split-window.c =================================================================== --- trunk/cmd-split-window.c 2012-08-14 09:38:34 UTC (rev 2860) +++ trunk/cmd-split-window.c 2012-08-31 09:18:50 UTC (rev 2861) @@ -139,7 +139,7 @@ if (args_has(args, 'P')) { if ((template = args_get(args, 'F')) == NULL) - template = DEFAULT_PANE_INFO_TEMPLATE; + template = SPLIT_WINDOW_TEMPLATE; ft = format_create(); if ((c = cmd_find_client(ctx, NULL)) != NULL) Modified: trunk/tmux.h =================================================================== --- trunk/tmux.h 2012-08-14 09:38:34 UTC (rev 2860) +++ trunk/tmux.h 2012-08-31 09:18:50 UTC (rev 2861) @@ -88,35 +88,75 @@ #define nitems(_a) (sizeof((_a)) / sizeof((_a)[0])) #endif -/* Default format templates. */ -#define DEFAULT_BUFFER_LIST_TEMPLATE \ +/* Default template for choose-buffer. */ +#define CHOOSE_BUFFER_TEMPLATE \ "#{line}: #{buffer_size} bytes: \"#{buffer_sample}\"" -#define DEFAULT_CLIENT_TEMPLATE \ + +/* Default template for choose-client. */ +#define CHOOSE_CLIENT_TEMPLATE \ "#{client_tty}: #{session_name} " \ "[#{client_width}x#{client_height} #{client_termname}]" \ "#{?client_utf8, (utf8),} #{?client_readonly, (ro),}" -#define DEFAULT_DISPLAY_MESSAGE_TEMPLATE \ + +/* Default templates for choose-tree. */ +#define CHOOSE_TREE_SESSION_TEMPLATE \ + "#{session_name}: #{session_windows} windows " \ + "#{?session_grouped, (group ,}" \ + "#{session_group}#{?session_grouped,),}" \ + "#{?session_attached, (attached),}" +#define CHOOSE_TREE_WINDOW_TEMPLATE \ + "#{window_index}: #{window_name}#{window_flags} " \ + "\"#{pane_title}\"" + +/* Default template for display-message. */ +#define DISPLAY_MESSAGE_TEMPLATE \ "[#{session_name}] #{window_index}:" \ "#{window_name}, current pane #{pane_index} " \ "- (%H:%M %d-%b-%y)" -#define DEFAULT_FIND_WINDOW_TEMPLATE \ + +/* Default template for find-window. */ +#define FIND_WINDOW_TEMPLATE \ "#{window_index}: #{window_name} " \ "[#{window_width}x#{window_height}] " \ "(#{window_panes} panes) #{window_find_matches}" -#define DEFAULT_SESSION_TEMPLATE \ + +/* Default template for list-buffers. */ +#define LIST_BUFFERS_TEMPLATE \ + "#{line}: #{buffer_size} bytes: \"#{buffer_sample}\"" + +/* Default template for list-clients. */ +#define LIST_CLIENTS_TEMPLATE \ + "#{client_tty}: #{session_name} " \ + "[#{client_width}x#{client_height} #{client_termname}]" \ + "#{?client_utf8, (utf8),} #{?client_readonly, (ro),}" + +/* Default template for list-sessions. */ +#define LIST_SESSIONS_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 \ + +/* Default templates for list-windows. */ +#define LIST_WINDOWS_TEMPLATE \ "#{window_index}: #{window_name}#{window_flags} " \ "(#{window_panes} panes) " \ - "[#{window_width}x#{window_height}]" -#define DEFAULT_PANE_INFO_TEMPLATE \ - "#{session_name}:#{window_index}.#{pane_index}" + "[#{window_width}x#{window_height}] " \ + "[layout #{window_layout}] #{window_id}" \ + "#{?window_active, (active),}"; +#define LIST_WINDOWS_WITH_SESSION_TEMPLATE \ + "#{session_name}: " \ + "#{window_index}: #{window_name}#{window_flags} " \ + "(#{window_panes} panes) " \ + "[#{window_width}x#{window_height}] " +/* Default templates for break-pane, new-window and split-window. */ +#define BREAK_PANE_TEMPLATE "#{session_name}:#{window_index}.#{pane_index}" +#define NEW_WINDOW_TEMPLATE BREAK_PANE_TEMPLATE +#define SPLIT_WINDOW_TEMPLATE BREAK_PANE_TEMPLATE + /* Bell option values. */ #define BELL_NONE 0 #define BELL_ANY 1 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