Currently, "even-horizontal" will split a 161-column terminal into 79
and 81, rather than 80/80; and "even-vertical" will split 44 lines into
20 and 22. The attached patch fixes this. Let me know if it looks
alright, and I'll commit it.

I noticed the default value for main-pane-width is set to 81, which
seems an odd value for me; why isn't it the more usual 80?

-- 
Micah J. Cowan
http://micah.cowan.name/
Index: sf/layout-set.c
===================================================================
--- sf.orig/layout-set.c	2010-12-02 20:33:38.935600000 -0800
+++ sf/layout-set.c	2010-12-02 20:39:31.803600000 -0800
@@ -135,10 +135,9 @@ layout_set_even_h(struct window *w)
 		return;
 
 	/* How many can we fit? */
-	if (w->sx / n < PANE_MINIMUM + 1)
+	width = (w->sx - (n-1)) / n;
+	if (width < PANE_MINIMUM + 1)
 		width = PANE_MINIMUM + 1;
-	else
-		width = w->sx / n;
 
 	/* Free the old root and construct a new. */
 	layout_free(w);
@@ -151,12 +150,12 @@ layout_set_even_h(struct window *w)
 	TAILQ_FOREACH(wp, &w->panes, entry) {
 		/* Create child cell. */
 		lcnew = layout_create_cell(lc);
-		layout_set_size(lcnew, width - 1, w->sy, xoff, 0);
+		layout_set_size(lcnew, width, w->sy, xoff, 0);
 		layout_make_leaf(lcnew, wp);
 		TAILQ_INSERT_TAIL(&lc->cells, lcnew, entry);
 
 		i++;
-		xoff += width;
+		xoff += width + 1;
 	}
 
 	/* Allocate any remaining space. */
@@ -189,10 +188,9 @@ layout_set_even_v(struct window *w)
 		return;
 
 	/* How many can we fit? */
-	if (w->sy / n < PANE_MINIMUM + 1)
+	height = (w->sy - (n-1)) / n
+	if (height < PANE_MINIMUM + 1)
 		height = PANE_MINIMUM + 1;
-	else
-		height = w->sy / n;
 
 	/* Free the old root and construct a new. */
 	layout_free(w);
@@ -205,12 +203,12 @@ layout_set_even_v(struct window *w)
 	TAILQ_FOREACH(wp, &w->panes, entry) {
 		/* Create child cell. */
 		lcnew = layout_create_cell(lc);
-		layout_set_size(lcnew, w->sx, height - 1, 0, yoff);
+		layout_set_size(lcnew, w->sx, height, 0, yoff);
 		layout_make_leaf(lcnew, wp);
 		TAILQ_INSERT_TAIL(&lc->cells, lcnew, entry);
 
 		i++;
-		yoff += height;
+		yoff += height + 1;
 	}
 
 	/* Allocate any remaining space. */
------------------------------------------------------------------------------
Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
Tap into the largest installed PC base & get more eyes on your game by
optimizing for Intel(R) Graphics Technology. Get started today with the
Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
http://p.sf.net/sfu/intelisp-dev2dev
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users

Reply via email to