make open_view() window size configurable
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
diff --git a/tog/tog.c b/tog/tog.c
index 4688ed6..c0bad35 100644
--- a/tog/tog.c
+++ b/tog/tog.c
@@ -109,14 +109,14 @@ close_view(struct tog_view *view)
}
static struct tog_view *
-open_view(void)
+open_view(int nlines, int ncols, int begin_y, int begin_x)
{
struct tog_view *view = malloc(sizeof(*view));
if (view == NULL)
return NULL;
- view->window = newwin(0, 0, 0, 0);
+ view->window = newwin(nlines, ncols, begin_y, begin_x);
if (view->window == NULL) {
close_view(view);
return NULL;
@@ -698,7 +698,7 @@ show_commit(struct commit_queue_entry *entry, struct got_repository *repo)
goto done;
}
- view = open_view();
+ view = open_view(0, 0, 0, 0);
if (view == NULL) {
err = got_error_from_errno();
goto done;
@@ -780,7 +780,7 @@ show_log_view(struct got_object_id *start_id, struct got_repository *repo,
err = NULL;
}
- view = open_view();
+ view = open_view(0, 0, 0, 0);
if (view == NULL) {
err = got_error_from_errno();
goto done;
@@ -1190,7 +1190,7 @@ cmd_diff(int argc, char *argv[])
if (error)
goto done;
- view = open_view();
+ view = open_view(0, 0, 0, 0);
if (view == NULL) {
error = got_error_from_errno();
goto done;
@@ -1635,7 +1635,7 @@ show_blame_view(const char *path, struct got_object_id *commit_id,
goto done;
SIMPLEQ_INSERT_HEAD(&blamed_commits, blamed_commit, entry);
- view = open_view();
+ view = open_view(0, 0, 0, 0);
if (view == NULL) {
err = got_error_from_errno();
goto done;
@@ -1796,7 +1796,7 @@ show_blame_view(const char *path, struct got_object_id *commit_id,
break;
if (pobj == NULL && obj == NULL)
break;
- diff_view = open_view();
+ diff_view = open_view(0, 0, 0, 0);
if (diff_view == NULL) {
err = got_error_from_errno();
break;
@@ -2199,7 +2199,7 @@ show_tree_view(struct got_tree_object *root, struct got_object_id *commit_id,
goto done;
}
- view = open_view();
+ view = open_view(0, 0, 0, 0);
if (view == NULL) {
err = got_error_from_errno();
goto done;