New option main-pane-width to set width of pane in left-vertical mode.

This commit is contained in:
Nicholas Marriott 2009-05-18 21:55:53 +00:00
parent 3ee4b334e7
commit 6e4b947d71
5 changed files with 30 additions and 23 deletions

3
TODO
View File

@ -81,8 +81,9 @@
what to do about manual mode?
- two independent manual modes: vertical and horizontal?
- proper grid mode? (hard)
hardcoded 81 for left-vertical is nasty. how else? window option?
- test bug sshing from freebsd console (tom iirc?)
- document manual-vertical changes
- document main-pane-width
- document clear-history
- document paste in status line
- document SIGUSR1 behaviour

View File

@ -1,4 +1,4 @@
/* $Id: cmd-set-window-option.c,v 1.24 2009-01-30 00:24:49 nicm Exp $ */
/* $Id: cmd-set-window-option.c,v 1.25 2009-05-18 21:55:53 nicm Exp $ */
/*
* Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
@ -61,6 +61,7 @@ const struct set_option_entry set_window_option_table[NSETWINDOWOPTION] = {
SET_OPTION_CHOICE, 0, 0, set_option_clock_mode_style_list },
{ "force-height", SET_OPTION_NUMBER, 0, INT_MAX, NULL },
{ "force-width", SET_OPTION_NUMBER, 0, INT_MAX, NULL },
{ "main-pane-width", SET_OPTION_NUMBER, 1, INT_MAX, NULL },
{ "mode-attr", SET_OPTION_ATTRIBUTES, 0, 0, NULL },
{ "mode-bg", SET_OPTION_COLOUR, 0, 0, NULL },
{ "mode-fg", SET_OPTION_COLOUR, 0, 0, NULL },

View File

@ -1,4 +1,4 @@
/* $Id: layout.c,v 1.11 2009-05-18 21:29:11 nicm Exp $ */
/* $Id: layout.c,v 1.12 2009-05-18 21:55:53 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@ -234,7 +234,7 @@ void
layout_left_v_refresh(struct window *w, int active_only)
{
struct window_pane *wp;
u_int i, n, height, yoff;
u_int i, n, mainwidth, height, yoff;
if (active_only)
return;
@ -244,8 +244,11 @@ layout_left_v_refresh(struct window *w, int active_only)
if (n == 0)
return;
/* Get the main pane width and add one for separator line. */
mainwidth = options_get_number(&w->options, "main-pane-width") + 1;
/* Need >1 pane and minimum columns; if fewer, display active only. */
if (n == 1 || w->sx < 82 + PANE_MINIMUM) {
if (n == 1 || w->sx < mainwidth + PANE_MINIMUM) {
layout_active_only_refresh(w, active_only);
return;
}
@ -264,7 +267,7 @@ layout_left_v_refresh(struct window *w, int active_only)
if (wp == TAILQ_FIRST(&w->panes)) {
wp->xoff = 0;
wp->yoff = 0;
window_pane_resize(wp, 81, w->sy);
window_pane_resize(wp, mainwidth - 1, w->sy);
wp->flags &= ~PANE_HIDDEN;
continue;
}
@ -275,12 +278,12 @@ layout_left_v_refresh(struct window *w, int active_only)
}
wp->flags &= ~PANE_HIDDEN;
wp->xoff = 82;
wp->xoff = mainwidth;
wp->yoff = yoff;
if (i != n - 1)
window_pane_resize(wp, w->sx - 82, height - 1);
window_pane_resize(wp, w->sx - mainwidth, height - 1);
else
window_pane_resize(wp, w->sx - 82, height);
window_pane_resize(wp, w->sx - mainwidth, height);
i++;
yoff += height;

26
tmux.c
View File

@ -1,4 +1,4 @@
/* $Id: tmux.c,v 1.117 2009-05-16 10:02:51 nicm Exp $ */
/* $Id: tmux.c,v 1.118 2009-05-18 21:55:53 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -293,44 +293,46 @@ main(int argc, char **argv)
options_set_number(&global_options, "buffer-limit", 9);
options_set_number(&global_options, "display-time", 750);
options_set_number(&global_options, "history-limit", 2000);
options_set_number(&global_options, "lock-after-time", 0);
options_set_number(&global_options, "message-attr", GRID_ATTR_REVERSE);
options_set_number(&global_options, "message-bg", 3);
options_set_number(&global_options, "message-fg", 0);
options_set_number(&global_options, "message-attr", GRID_ATTR_REVERSE);
options_set_number(&global_options, "prefix", '\002');
options_set_number(&global_options, "repeat-time", 500);
options_set_number(&global_options, "set-titles", 1);
options_set_number(&global_options, "lock-after-time", 0);
options_set_number(&global_options, "set-remain-on-exit", 0);
options_set_number(&global_options, "set-titles", 1);
options_set_number(&global_options, "status", 1);
options_set_number(&global_options, "status-attr", GRID_ATTR_REVERSE);
options_set_number(&global_options, "status-bg", 2);
options_set_number(&global_options, "status-fg", 0);
options_set_number(&global_options, "status-attr", GRID_ATTR_REVERSE);
options_set_number(&global_options, "status-interval", 15);
options_set_number(&global_options, "status-keys", MODEKEY_EMACS);
options_set_number(&global_options, "status-left-length", 10);
options_set_number(&global_options, "status-right-length", 40);
options_set_string(&global_options, "status-left", "[#S]");
options_set_string(
&global_options, "status-right", "\"#24T\" %%H:%%M %%d-%%b-%%y");
options_set_number(&global_options, "status-keys", MODEKEY_EMACS);
options_init(&global_window_options, NULL);
options_set_number(&global_window_options, "aggressive-resize", 0);
options_set_number(&global_window_options, "automatic-rename", 1);
options_set_number(&global_window_options, "clock-mode-colour", 4);
options_set_number(&global_window_options, "clock-mode-style", 1);
options_set_number(&global_window_options, "force-height", 0);
options_set_number(&global_window_options, "force-width", 0);
options_set_number(&global_window_options, "automatic-rename", 1);
options_set_number(&global_window_options, "mode-bg", 3);
options_set_number(&global_window_options, "mode-fg", 0);
options_set_number(
&global_window_options, "mode-attr", GRID_ATTR_REVERSE);
options_set_number(&global_window_options, "main-pane-width", 81);
options_set_number(&global_window_options, "mode-bg", 3);
options_set_number(&global_window_options, "mode-fg", 0);
options_set_number(&global_window_options, "mode-keys", MODEKEY_EMACS);
options_set_number(&global_window_options, "monitor-activity", 0);
options_set_number(&global_window_options, "utf8", 0);
options_set_number(&global_window_options, "xterm-keys", 0);
options_set_number(&global_window_options, "remain-on-exit", 0);
options_set_number(&global_window_options, "window-status-attr", 0);
options_set_number(&global_window_options, "window-status-bg", 8);
options_set_number(&global_window_options, "window-status-fg", 8);
options_set_number(&global_window_options, "window-status-attr", 0);
options_set_number(&global_window_options, "xterm-keys", 0);
options_set_number(&global_window_options, "remain-on-exit", 0);
if (cfg_file == NULL) {
home = getenv("HOME");

4
tmux.h
View File

@ -1,4 +1,4 @@
/* $Id: tmux.h,v 1.322 2009-05-18 21:29:11 nicm Exp $ */
/* $Id: tmux.h,v 1.323 2009-05-18 21:55:53 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -1001,7 +1001,7 @@ struct set_option_entry {
extern const struct set_option_entry set_option_table[];
extern const struct set_option_entry set_window_option_table[];
#define NSETOPTION 24
#define NSETWINDOWOPTION 17
#define NSETWINDOWOPTION 18
#ifndef HAVE_STRTONUM
/* strtonum.c */