Update of /cvsroot/tmux/tmux
In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv17062
Modified Files:
layout-set.c tmux.c
Log Message:
In the built-in layouts, distribute the panes more evenly.
Set the default value of main-pane-width to 80, rather than 81.
Index: layout-set.c
===================================================================
RCS file: /cvsroot/tmux/tmux/layout-set.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- layout-set.c 14 May 2010 14:16:37 -0000 1.6
+++ layout-set.c 7 Dec 2010 20:23:21 -0000 1.7
@@ -135,10 +135,9 @@
return;
/* How many can we fit? */
- if (w->sx / n < PANE_MINIMUM + 1)
- width = PANE_MINIMUM + 1;
- else
- width = w->sx / n;
+ width = (w->sx - (n - 1)) / n;
+ if (width < PANE_MINIMUM)
+ width = PANE_MINIMUM;
/* Free the old root and construct a new. */
layout_free(w);
@@ -151,12 +150,12 @@
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 @@
return;
/* How many can we fit? */
- if (w->sy / n < PANE_MINIMUM + 1)
- height = PANE_MINIMUM + 1;
- else
- height = w->sy / n;
+ height = (w->sy - (n - 1)) / n;
+ if (height < PANE_MINIMUM)
+ height = PANE_MINIMUM;
/* Free the old root and construct a new. */
layout_free(w);
@@ -205,12 +203,12 @@
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. */
@@ -244,13 +242,13 @@
return;
n--; /* take off main pane */
- /* How many rows and columns will be needed? */
- columns = w->sx / (PANE_MINIMUM + 1); /* maximum columns */
+ /* How many rows and columns will be needed, not counting main? */
+ columns = (w->sx + 1) / (PANE_MINIMUM + 1); /* maximum columns */
if (columns == 0)
columns = 1;
rows = 1 + (n - 1) / columns;
columns = 1 + (n - 1) / rows;
- width = w->sx / columns;
+ width = (w->sx - (n - 1)) / columns;
/* Get the main pane height and add one for separator line. */
mainheight = options_get_number(&w->options, "main-pane-height") + 1;
@@ -264,14 +262,14 @@
mainheight = PANE_MINIMUM + 2;
else
mainheight = w->sy - totalrows;
- height = PANE_MINIMUM + 1;
+ height = PANE_MINIMUM;
} else
- height = (w->sy - mainheight) / rows;
+ height = (w->sy - mainheight - (rows - 1)) / rows;
/* Free old tree and create a new root. */
layout_free(w);
lc = w->layout_root = layout_create_cell(NULL);
- layout_set_size(lc, w->sx, mainheight + rows * height, 0, 0);
+ layout_set_size(lc, w->sx, mainheight + rows * (height + 1) - 1, 0, 0);
layout_make_node(lc, LAYOUT_TOPBOTTOM);
/* Create the main pane. */
@@ -289,7 +287,7 @@
/* Create the new row. */
lcrow = layout_create_cell(lc);
- layout_set_size(lcrow, w->sx, height - 1, 0, 0);
+ layout_set_size(lcrow, w->sx, height, 0, 0);
TAILQ_INSERT_TAIL(&lc->cells, lcrow, entry);
/* If only one column, just use the row directly. */
@@ -304,7 +302,7 @@
for (i = 0; i < columns; i++) {
/* Create and add a pane cell. */
lcchild = layout_create_cell(lcrow);
- layout_set_size(lcchild, width - 1, height - 1, 0, 0);
+ layout_set_size(lcchild, width, height, 0, 0);
layout_make_leaf(lcchild, wp);
TAILQ_INSERT_TAIL(&lcrow->cells, lcchild, entry);
@@ -316,7 +314,7 @@
/* Adjust the row to fit the full width if necessary. */
if (i == columns)
i--;
- used = ((i + 1) * width) - 1;
+ used = ((i + 1) * (width + 1)) - 1;
if (w->sx <= used)
continue;
lcchild = TAILQ_LAST(&lcrow->cells, layout_cells);
@@ -324,7 +322,7 @@
}
/* Adjust the last row height to fit if necessary. */
- used = mainheight + (rows * height) - 1;
+ used = mainheight + (rows * height) + rows - 1;
if (w->sy > used) {
lcrow = TAILQ_LAST(&lc->cells, layout_cells);
layout_resize_adjust(lcrow, LAYOUT_TOPBOTTOM, w->sy - used);
@@ -355,13 +353,13 @@
return;
n--; /* take off main pane */
- /* How many rows and columns will be needed? */
- rows = w->sy / (PANE_MINIMUM + 1); /* maximum rows */
+ /* How many rows and columns will be needed, not counting main? */
+ rows = (w->sy + 1) / (PANE_MINIMUM + 1); /* maximum rows */
if (rows == 0)
rows = 1;
columns = 1 + (n - 1) / rows;
rows = 1 + (n - 1) / columns;
- height = w->sy / rows;
+ height = (w->sy - (n - 1)) / rows;
/* Get the main pane width and add one for separator line. */
mainwidth = options_get_number(&w->options, "main-pane-width") + 1;
@@ -375,14 +373,14 @@
mainwidth = PANE_MINIMUM + 2;
else
mainwidth = w->sx - totalcolumns;
- width = PANE_MINIMUM + 1;
+ width = PANE_MINIMUM;
} else
- width = (w->sx - mainwidth) / columns;
+ width = (w->sx - mainwidth - (columns - 1)) / columns;
/* Free old tree and create a new root. */
layout_free(w);
lc = w->layout_root = layout_create_cell(NULL);
- layout_set_size(lc, mainwidth + columns * width, w->sy, 0, 0);
+ layout_set_size(lc, mainwidth + columns * (width + 1) - 1, w->sy, 0, 0);
layout_make_node(lc, LAYOUT_LEFTRIGHT);
/* Create the main pane. */
@@ -400,7 +398,7 @@
/* Create the new column. */
lccolumn = layout_create_cell(lc);
- layout_set_size(lccolumn, width - 1, w->sy, 0, 0);
+ layout_set_size(lccolumn, width, w->sy, 0, 0);
TAILQ_INSERT_TAIL(&lc->cells, lccolumn, entry);
/* If only one row, just use the row directly. */
@@ -415,7 +413,7 @@
for (i = 0; i < rows; i++) {
/* Create and add a pane cell. */
lcchild = layout_create_cell(lccolumn);
- layout_set_size(lcchild, width - 1, height - 1, 0, 0);
+ layout_set_size(lcchild, width, height, 0, 0);
layout_make_leaf(lcchild, wp);
TAILQ_INSERT_TAIL(&lccolumn->cells, lcchild, entry);
@@ -427,7 +425,7 @@
/* Adjust the column to fit the full height if necessary. */
if (i == rows)
i--;
- used = ((i + 1) * height) - 1;
+ used = ((i + 1) * (height + 1)) - 1;
if (w->sy <= used)
continue;
lcchild = TAILQ_LAST(&lccolumn->cells, layout_cells);
@@ -435,7 +433,7 @@
}
/* Adjust the last column width to fit if necessary. */
- used = mainwidth + (columns * width) - 1;
+ used = mainwidth + (columns * width) + columns - 1;
if (w->sx > used) {
lccolumn = TAILQ_LAST(&lc->cells, layout_cells);
layout_resize_adjust(lccolumn, LAYOUT_LEFTRIGHT, w->sx - used);
@@ -474,17 +472,18 @@
}
/* What width and height should they be? */
- width = w->sx / columns;
- if (width < PANE_MINIMUM + 1)
- width = PANE_MINIMUM + 1;
- height = w->sy / rows;
- if (width < PANE_MINIMUM + 1)
- width = PANE_MINIMUM + 1;
+ width = (w->sx - (columns - 1)) / columns;
+ if (width < PANE_MINIMUM)
+ width = PANE_MINIMUM;
+ height = (w->sy - (rows - 1)) / rows;
+ if (height < PANE_MINIMUM)
+ height = PANE_MINIMUM;
/* Free old tree and create a new root. */
layout_free(w);
lc = w->layout_root = layout_create_cell(NULL);
- layout_set_size(lc, width * columns, height * rows, 0, 0);
+ layout_set_size(lc, (width + 1) * columns - 1,
+ (height + 1) * rows - 1, 0, 0);
layout_make_node(lc, LAYOUT_TOPBOTTOM);
/* Create a grid of the cells. */
@@ -496,7 +495,7 @@
/* Create the new row. */
lcrow = layout_create_cell(lc);
- layout_set_size(lcrow, w->sx, height - 1, 0, 0);
+ layout_set_size(lcrow, w->sx, height, 0, 0);
TAILQ_INSERT_TAIL(&lc->cells, lcrow, entry);
/* If only one column, just use the row directly. */
@@ -511,7 +510,7 @@
for (i = 0; i < columns; i++) {
/* Create and add a pane cell. */
lcchild = layout_create_cell(lcrow);
- layout_set_size(lcchild, width - 1, height - 1, 0, 0);
+ layout_set_size(lcchild, width, height, 0, 0);
layout_make_leaf(lcchild, wp);
TAILQ_INSERT_TAIL(&lcrow->cells, lcchild, entry);
@@ -526,7 +525,7 @@
*/
if (i == columns)
i--;
- used = ((i + 1) * width) - 1;
+ used = ((i + 1) * (width + 1)) - 1;
if (w->sx <= used)
continue;
lcchild = TAILQ_LAST(&lcrow->cells, layout_cells);
@@ -534,7 +533,7 @@
}
/* Adjust the last row height to fit if necessary. */
- used = (rows * height) - 1;
+ used = (rows * height) + rows - 1;
if (w->sy > used) {
lcrow = TAILQ_LAST(&lc->cells, layout_cells);
layout_resize_adjust(lcrow, LAYOUT_TOPBOTTOM, w->sy - used);
Index: tmux.c
===================================================================
RCS file: /cvsroot/tmux/tmux/tmux.c,v
retrieving revision 1.224
retrieving revision 1.225
diff -u -d -r1.224 -r1.225
--- tmux.c 6 Dec 2010 22:52:21 -0000 1.224
+++ tmux.c 7 Dec 2010 20:23:21 -0000 1.225
@@ -399,7 +399,7 @@
options_set_number(wo, "force-height", 0);
options_set_number(wo, "force-width", 0);
options_set_number(wo, "main-pane-height", 24);
- options_set_number(wo, "main-pane-width", 81);
+ options_set_number(wo, "main-pane-width", 80);
options_set_number(wo, "mode-attr", 0);
options_set_number(wo, "mode-bg", 3);
options_set_number(wo, "mode-fg", 0);
------------------------------------------------------------------------------
What happens now with your Lotus Notes apps - do you make another costly
upgrade, or settle for being marooned without product support? Time to move
off Lotus Notes and onto the cloud with Force.com, apps are easier to build,
use, and manage than apps on traditional platforms. Sign up for the Lotus
Notes Migration Kit to learn more. http://p.sf.net/sfu/salesforce-d2d
_______________________________________________
tmux-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tmux-cvs