Nicholas,

Your recent commit to OpenBSD to add the computed line number to the item in
choose-mode, uses a width calculation which wasn't being initialised
correctly.

This patch should fix that.  Apply against OpenBSD.

-- 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 28bfa311c3d78b3f9d0ac9d3b000b585e4055a5a Mon Sep 17 00:00:00 2001
From: Thomas Adam <tho...@xteddy.org>
Date: Sat, 11 Aug 2012 22:29:14 +0100
Subject: [PATCH 1/1] Fix width handling of item count in choose-cmds

When displaying the line number of the item list, ensure we initialise it
correctly.
---
 trunk/window-choose.c |    5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/trunk/window-choose.c b/trunk/window-choose.c
index 43b5a7b..f65f43c 100644
--- a/trunk/window-choose.c
+++ b/trunk/window-choose.c
@@ -80,7 +80,6 @@ window_choose_add(struct window_pane *wp, struct window_choose_data *wcd)
 {
 	struct window_choose_mode_data	*data = wp->modedata;
 	struct window_choose_mode_item	*item;
-	int				 width;
 	char				 tmp[10];
 
 	ARRAY_EXPAND(&data->list, 1);
@@ -90,9 +89,7 @@ window_choose_add(struct window_pane *wp, struct window_choose_data *wcd)
 	item->wcd = wcd;
 	item->pos = ARRAY_LENGTH(&data->list) - 1;
 
-	width = snprintf (tmp, sizeof tmp, "%u", item->pos);
-	if (width > data->width)
-		data->width = width;
+	data->width = snprintf (tmp, sizeof(tmp), "%u", item->pos);
 }
 
 void
-- 
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