commit - 5221c383beb29464d4e3d24845cf8d1089aed881
commit + 6d0fee91bc1d9e72a0518facddd23eff96bf2c45
blob - ffde15b81472f1a5591360da7b09bea4bade0d98
blob + f1de40ed847f5272eb7980be126095d0f2680fb2
--- tog/tog.c
+++ tog/tog.c
PANEL *panel;
int nlines, ncols, begin_y, begin_x;
int lines, cols; /* copies of LINES and COLS */
+ struct tog_view *parent;
};
static const struct got_error *
}
static struct tog_view *
-open_view(int nlines, int ncols, int begin_y, int begin_x)
+open_view(int nlines, int ncols, int begin_y, int begin_x,
+ struct tog_view *parent)
{
struct tog_view *view = malloc(sizeof(*view));
if (view == NULL)
return NULL;
+ view->parent = parent;
view->lines = LINES;
view->cols = COLS;
view->nlines = nlines ? nlines : LINES - begin_y;
{
int nlines, ncols;
- if (view->lines > LINES)
- nlines = view->nlines - (view->lines - LINES);
- else
- nlines = view->nlines + (LINES - view->lines);
+ while (view) {
+ if (view->lines > LINES)
+ nlines = view->nlines - (view->lines - LINES);
+ else
+ nlines = view->nlines + (LINES - view->lines);
- if (view->cols > COLS)
- ncols = view->ncols - (view->cols - COLS);
- else
- ncols = view->ncols + (COLS - view->cols);
+ if (view->cols > COLS)
+ ncols = view->ncols - (view->cols - COLS);
+ else
+ ncols = view->ncols + (COLS - view->cols);
- if (wresize(view->window, nlines, ncols) == ERR)
- return got_error_from_errno();
+ if (wresize(view->window, nlines, ncols) == ERR)
+ return got_error_from_errno();
- view->nlines = nlines;
- view->ncols = ncols;
- view->lines = LINES;
- view->cols = COLS;
+ view->nlines = nlines;
+ view->ncols = ncols;
+ view->lines = LINES;
+ view->cols = COLS;
+
+ view = view->parent;
+ }
+
return NULL;
}
}
static const struct got_error *
-show_commit(struct commit_queue_entry *entry, struct got_repository *repo)
+show_commit(struct tog_view *parent_view, struct commit_queue_entry *entry,
+ struct got_repository *repo)
{
const struct got_error *err;
struct got_object *obj1 = NULL, *obj2 = NULL;
goto done;
}
- view = open_view(0, 0, 0, 0);
+ view = open_view(0, 0, 0, 0, parent_view);
if (view == NULL) {
err = got_error_from_errno();
goto done;
}
static const struct got_error *
-browse_commit(struct commit_queue_entry *entry, struct got_repository *repo)
+browse_commit(struct tog_view *parent_view, struct commit_queue_entry *entry,
+ struct got_repository *repo)
{
const struct got_error *err = NULL;
struct got_tree_object *tree;
if (err)
return err;
- view = open_view(0, 0, 0, 0);
+ view = open_view(0, 0, 0, 0, parent_view);
if (view == NULL) {
err = got_error_from_errno();
goto done;
break;
case KEY_ENTER:
case '\r':
- err = show_commit(selected_entry, repo);
+ err = show_commit(view, selected_entry, repo);
if (err)
goto done;
show_panel(view->panel);
break;
case 't':
- err = browse_commit(selected_entry, repo);
+ err = browse_commit(view, selected_entry, repo);
if (err)
goto done;
show_panel(view->panel);
if (error != NULL)
goto done;
- view = open_view(0, 0, 0, 0);
+ view = open_view(0, 0, 0, 0, NULL);
if (view == NULL) {
error = got_error_from_errno();
goto done;
if (error)
goto done;
- view = open_view(0, 0, 0, 0);
+ view = open_view(0, 0, 0, 0, NULL);
if (view == NULL) {
error = got_error_from_errno();
goto done;
break;
if (pobj == NULL && obj == NULL)
break;
- diff_view = open_view(0, 0, 0, 0);
+ diff_view = open_view(0, 0, 0, 0, view);
if (diff_view == NULL) {
err = got_error_from_errno();
break;
if (error != NULL)
goto done;
- view = open_view(0, 0, 0, 0);
+ view = open_view(0, 0, 0, 0, NULL);
if (view == NULL) {
error = got_error_from_errno();
goto done;
case 'l':
if (selected_entry) {
struct tog_view *log_view;
- log_view = open_view(0, 0, 0, 0);
+ log_view = open_view(0, 0, 0, 0, view);
if (log_view == NULL) {
err = got_error_from_errno();
goto done;
selected = 0;
first_displayed_entry = NULL;
} else if (S_ISREG(selected_entry->mode)) {
- struct tog_view *blame_view;
- blame_view = open_view(0, 0, 0, 0);
+ struct tog_view *blame_view =
+ open_view(0, 0, 0, 0, view);
if (blame_view == NULL) {
err = got_error_from_errno();
goto done;
if (error != NULL)
goto done;
- view = open_view(0, 0, 0, 0);
+ view = open_view(0, 0, 0, 0, NULL);
if (view == NULL) {
error = got_error_from_errno();
goto done;