diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2010-12-19 18:35:09 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2010-12-19 18:35:09 +0000 |
commit | 982cfcb5740407f427a8de0b03cd465ebd0c6337 (patch) | |
tree | 9b59c3d613cc4c577e112a86c79375ca69698102 | |
parent | d24ecc24fc053f9208b60a7b31be888b016c17a8 (diff) |
Add other-pane-height and other-pane-width options, allowing the width
or height of the smaller panes in the main-horizontal and main-vertical
layouts to be set. Mostly from David Goodlad.
-rw-r--r-- | usr.bin/tmux/cmd-set-option.c | 4 | ||||
-rw-r--r-- | usr.bin/tmux/layout-set.c | 30 | ||||
-rw-r--r-- | usr.bin/tmux/tmux.1 | 23 | ||||
-rw-r--r-- | usr.bin/tmux/tmux.c | 4 |
4 files changed, 52 insertions, 9 deletions
diff --git a/usr.bin/tmux/cmd-set-option.c b/usr.bin/tmux/cmd-set-option.c index 8c9d40572d9..1ee1379241a 100644 --- a/usr.bin/tmux/cmd-set-option.c +++ b/usr.bin/tmux/cmd-set-option.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-set-option.c,v 1.40 2010/12/06 22:51:02 nicm Exp $ */ +/* $OpenBSD: cmd-set-option.c,v 1.41 2010/12/19 18:35:08 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -159,6 +159,8 @@ const struct set_option_entry set_window_option_table[] = { { "monitor-activity", SET_OPTION_FLAG, 0, 0, NULL }, { "monitor-content", SET_OPTION_STRING, 0, 0, NULL }, { "monitor-silence",SET_OPTION_NUMBER, 0, INT_MAX, NULL}, + { "other-pane-height", SET_OPTION_NUMBER, 0, INT_MAX, NULL }, + { "other-pane-width", SET_OPTION_NUMBER, 0, INT_MAX, NULL }, { "remain-on-exit", SET_OPTION_FLAG, 0, 0, NULL }, { "synchronize-panes", SET_OPTION_FLAG, 0, 0, NULL }, { "utf8", SET_OPTION_FLAG, 0, 0, NULL }, diff --git a/usr.bin/tmux/layout-set.c b/usr.bin/tmux/layout-set.c index 0b87e43c41a..5dbceb10b08 100644 --- a/usr.bin/tmux/layout-set.c +++ b/usr.bin/tmux/layout-set.c @@ -1,4 +1,4 @@ -/* $OpenBSD: layout-set.c,v 1.7 2010/12/08 19:57:03 nicm Exp $ */ +/* $OpenBSD: layout-set.c,v 1.8 2010/12/19 18:35:08 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net> @@ -231,8 +231,8 @@ layout_set_main_h(struct window *w) { struct window_pane *wp; struct layout_cell *lc, *lcmain, *lcrow, *lcchild; - u_int n, mainheight, width, height, used; - u_int i, j, columns, rows, totalrows; + u_int n, mainheight, otherheight, width, height; + u_int used, i, j, columns, rows, totalrows; layout_print_cell(w->layout_root, __func__, 1); @@ -252,6 +252,16 @@ layout_set_main_h(struct window *w) /* Get the main pane height and add one for separator line. */ mainheight = options_get_number(&w->options, "main-pane-height") + 1; + + /* Get the optional other pane height and add one for separator line. */ + otherheight = options_get_number(&w->options, "other-pane-height") + 1; + + /* + * If an other pane height was specified, honour it so long as it + * doesn't shrink the main height to less than the main-pane-height + */ + if (otherheight > 1 && w->sx - otherheight > mainheight) + mainheight = w->sx - otherheight; if (mainheight < PANE_MINIMUM + 1) mainheight = PANE_MINIMUM + 1; @@ -342,8 +352,8 @@ layout_set_main_v(struct window *w) { struct window_pane *wp; struct layout_cell *lc, *lcmain, *lccolumn, *lcchild; - u_int n, mainwidth, width, height, used; - u_int i, j, columns, rows, totalcolumns; + u_int n, mainwidth, otherwidth, width, height; + u_int used, i, j, columns, rows, totalcolumns; layout_print_cell(w->layout_root, __func__, 1); @@ -363,6 +373,16 @@ layout_set_main_v(struct window *w) /* Get the main pane width and add one for separator line. */ mainwidth = options_get_number(&w->options, "main-pane-width") + 1; + + /* Get the optional other pane width and add one for separator line. */ + otherwidth = options_get_number(&w->options, "other-pane-width") + 1; + + /* + * If an other pane width was specified, honour it so long as it + * doesn't shrink the main width to less than the main-pane-width + */ + if (otherwidth > 1 && w->sx - otherwidth > mainwidth) + mainwidth = w->sx - otherwidth; if (mainwidth < PANE_MINIMUM + 1) mainwidth = PANE_MINIMUM + 1; diff --git a/usr.bin/tmux/tmux.1 b/usr.bin/tmux/tmux.1 index 2cf9ff13c45..065eefb6e45 100644 --- a/usr.bin/tmux/tmux.1 +++ b/usr.bin/tmux/tmux.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: tmux.1,v 1.194 2010/12/11 18:39:25 nicm Exp $ +.\" $OpenBSD: tmux.1,v 1.195 2010/12/19 18:35:08 nicm Exp $ .\" .\" Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> .\" @@ -14,7 +14,7 @@ .\" IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING .\" OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: December 11 2010 $ +.Dd $Mdocdate: December 19 2010 $ .Dt TMUX 1 .Os .Sh NAME @@ -2195,6 +2195,25 @@ Windows that have been silent for the interval are highlighted in the status line. An interval of zero disables the monitoring. .Pp +.It Ic other-pane-height Ar height +Set the height of the other panes (not the main pane) in the +.Ic main-horizontal +layout. +If this option is set to 0 (the default), it will have no effect. +If both the +.Ic main-pane-height +and +.Ic other-pane-height +options are set, the main pane will grow taller to make the other panes the +specified height, but will never shrink to do so. +.Pp +.It Ic other-pane-width Ar width +Like +.Ic other-pane-height , +but set the width of other panes in the +.Ic main-vertical +layout. +.Pp .It Xo Ic remain-on-exit .Op Ic on | off .Xc diff --git a/usr.bin/tmux/tmux.c b/usr.bin/tmux/tmux.c index d07308a3ba3..75f1a1da14c 100644 --- a/usr.bin/tmux/tmux.c +++ b/usr.bin/tmux/tmux.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tmux.c,v 1.96 2010/12/08 19:57:03 nicm Exp $ */ +/* $OpenBSD: tmux.c,v 1.97 2010/12/19 18:35:08 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -404,6 +404,8 @@ main(int argc, char **argv) options_set_number(wo, "monitor-activity", 0); options_set_string(wo, "monitor-content", "%s", ""); options_set_number(wo, "monitor-silence", 0); + options_set_number(wo, "other-pane-height", 0); + options_set_number(wo, "other-pane-width", 0); options_set_number(wo, "window-status-attr", 0); options_set_number(wo, "window-status-bg", 8); options_set_number(wo, "window-status-current-attr", 0); |