Hi,

On Sat, Aug 11, 2012 at 07:49:48AM +0100, Nicholas Marriott wrote:
> Sorry thought this was a separate change not a new version - DOH. Can
> you redo this so it is on top of V1 now?

Slightly tricky, because you've now made item->pos integral to how the
information about each choose item is rendered.  The basic idea behind V2 of
this was to remove item->pos and make the entries numbered by using #{line}
which to me made sense, because you could them intentionally turn that off.

Why?  Because with my other patches in the pipeline -- choose-list -- you
would currently with this way of working, always get numbered entries at the
start of the line, which I'd argue is undesirable, but since we already
provide a means to avoid this with #{line} -- figured that making that part
of the template was the right thing to do.

I'm attaching the patch which adds this #{line} information -- and I'll
defer how you might want to plug that in to the logic as you've implemented
it, if you don't mind?  I suspect you'll have to go back to the original
implementation as I had it in order for this to work -- not too sure.

Kindly,

-- Thomas Adam

-- 
"It was the cruelest game I've ever played and it's played inside my head."
-- "Hush The Warmth", Gorky's Zygotic Mynci.
>From 7f39673f8d41af2d951d1f3aaae7a880173b768a Mon Sep 17 00:00:00 2001
From: Thomas Adam <tho...@xteddy.org>
Date: Sat, 21 Jul 2012 19:03:13 +0100
Subject: [PATCH 1/1] Use #{line} at the start of some default templates

Since key-combinations can mark entries, rather than making this different
from the template, add the "line" marker to the template, and allow users to
override that with -F in some commands to turn it off if wanted.
---
 trunk/cmd-choose-tree.c |    6 ++++--
 trunk/tmux.h            |   40 ++++++++++++++++++++--------------------
 2 files changed, 24 insertions(+), 22 deletions(-)

diff --git a/trunk/cmd-choose-tree.c b/trunk/cmd-choose-tree.c
index b33bf34..46d940d 100644
--- a/trunk/cmd-choose-tree.c
+++ b/trunk/cmd-choose-tree.c
@@ -149,7 +149,8 @@ cmd_choose_tree_exec(struct cmd *self, struct cmd_ctx *ctx)
 	 * without any padding.
 	 */
 	if (wflag && sflag)
-		xasprintf(&final_win_template, "    --> %s", win_template);
+		xasprintf(&final_win_template, "(#{line})    --> %s",
+			win_template);
 	else if (wflag)
 		final_win_template = xstrdup(win_template);
 	else
@@ -203,7 +204,8 @@ windows_only:
 
 			window_choose_add_window(wl->window->active,
 				ctx, s2, wm, final_win_template,
-				final_win_action, idx_ses);
+				final_win_action,
+				(wflag && !sflag) ? win_ses : idx_ses);
 
 			free(final_win_action);
 		}
diff --git a/trunk/tmux.h b/trunk/tmux.h
index 49f053f..02acf86 100644
--- a/trunk/tmux.h
+++ b/trunk/tmux.h
@@ -89,32 +89,32 @@ extern char   **environ;
 #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}]"	\
+#define DEFAULT_BUFFER_LIST_TEMPLATE					\
+	"(#{line}) #{line}: #{buffer_size} bytes: \"#{buffer_sample}\""
+#define DEFAULT_CLIENT_TEMPLATE						\
+	"(#{line})  #{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} "		\
+#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}] "			\
+#define DEFAULT_FIND_WINDOW_TEMPLATE					\
+	"(#{line})  #{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,),}"		\
+	"(#{line})  #{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) "				\
+#define DEFAULT_WINDOW_TEMPLATE						\
+	"(#{line})  #{window_index}: #{window_name}#{window_flags} "	\
+	"(#{window_panes} panes) "					\
 	"[#{window_width}x#{window_height}]"
-#define DEFAULT_PANE_INFO_TEMPLATE				\
+#define DEFAULT_PANE_INFO_TEMPLATE					\
 	"#{session_name}:#{window_index}.#{pane_index}"
 
 /* Bell option values. */
-- 
1.7.10

------------------------------------------------------------------------------
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-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users

Reply via email to