summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ced92a5)
raw | patch | inline | side by side (parent: ced92a5)
author | Tilo Schwarz <tilo@tilo-schwarz.de> | |
Mon, 23 Feb 2009 22:24:03 +0000 (23:24 +0100) | ||
committer | Jonas Fonseca <fonseca@diku.dk> | |
Wed, 25 Feb 2009 22:09:58 +0000 (23:09 +0100) |
Signed-off-by: Tilo Schwarz <tilo@tilo-schwarz.de>
Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
NEWS | patch | blob | history | |
tig.c | patch | blob | history | |
tigrc.5.txt | patch | blob | history |
index 15d898b9037a04918f24c368928404f0ad6762d0..cf56f493a11965cbf7c8845c27b1a42e4c84083b 100644 (file)
--- a/NEWS
+++ b/NEWS
- Tree view: sort entries by name, date or author. Toggling is bound to
'i' by default, with 'I' controlling whether or not to sort in
ascending order.
+ - Make height of the lower view in a split view configurable by setting
+ the 'split-view-height' variable to a number or a percentage.
+ Defaults to 2/3 of the total view height.
Bug fixes:
index 58d7bd09137dd73ac495d2079eed24874934e97f..ad77c95d038b61993a21f514549aa966748105e7 100644 (file)
--- a/tig.c
+++ b/tig.c
#define ABS(x) ((x) >= 0 ? (x) : -(x))
#define MIN(x, y) ((x) < (y) ? (x) : (y))
+#define MAX(x, y) ((x) > (y) ? (x) : (y))
#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
#define STRING_SIZE(x) (sizeof(x) - 1)
@@ -111,7 +112,8 @@ static size_t utf8_length(const char **string, size_t col, int *width, size_t ma
#define TAB_SIZE 8
-#define SCALE_SPLIT_VIEW(height) ((height) * 2 / 3)
+#define SCALE_SPLIT_VIEW (2.0 / 3.0)
+#define MIN_VIEW_HEIGHT 4
#define NULL_ID "0000000000000000000000000000000000000000"
static bool opt_show_refs = TRUE;
static int opt_num_interval = NUMBER_INTERVAL;
static double opt_hscroll = 0.50;
+static double opt_scale_split_view = SCALE_SPLIT_VIEW;
static int opt_tab_size = TAB_SIZE;
static int opt_author_cols = AUTHOR_COLS-1;
static char opt_path[SIZEOF_STR] = "";
if (!strcmp(argv[0], "horizontal-scroll"))
return parse_step(&opt_hscroll, argv[2]);
+ if (!strcmp(argv[0], "split-view-height"))
+ return parse_step(&opt_scale_split_view, argv[2]);
+
if (!strcmp(argv[0], "tab-size"))
return parse_int(&opt_tab_size, argv[2], 1, 1024);
wnoutrefresh(view->title);
}
+static int
+apply_step(double step, int value)
+{
+ if (step >= 1)
+ return (int) step;
+ value *= step + 0.01;
+ return value ? value : 1;
+}
+
static void
resize_display(void)
{
if (view != base) {
/* Horizontal split. */
view->width = base->width;
- view->height = SCALE_SPLIT_VIEW(base->height);
+ view->height = apply_step(opt_scale_split_view, base->height);
+ view->height = MAX(view->height, MIN_VIEW_HEIGHT);
+ view->height = MIN(view->height, base->height - MIN_VIEW_HEIGHT);
base->height -= view->height;
/* Make room for the title bar. */
@@ -2353,15 +2370,6 @@ goto_view_line(struct view *view, unsigned long offset, unsigned long lineno)
return FALSE;
}
-static int
-apply_step(double step, int value)
-{
- if (step >= 1)
- return (int) step;
- value *= step + 0.01;
- return value ? value : 1;
-}
-
/* Scrolling backend */
static void
do_scroll_view(struct view *view, int lines)
diff --git a/tigrc.5.txt b/tigrc.5.txt
index 8b9628f030152f09f3a6523c455809481a9d416e..e5de6921e31bc18953514ebe757073f476487336 100644 (file)
--- a/tigrc.5.txt
+++ b/tigrc.5.txt
always ensured that at least one column is scrolled. The default is to
scroll '50%' of the view width.
+'split-view-height' (mixed)::
+
+ Height of the lower view in a split view. Can be specified either as
+ the number of rows, e.g. '5', or as a percentage of the view height,
+ e.g. '80%', where the maximum is 100%. It is always ensured that the
+ smaller of the views is at least four rows high. The default is a view
+ height of '66%'.
+
'commit-encoding' (string)::
The encoding used for commits. The default is UTF-8. Not this option