summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 85980cd)
raw | patch | inline | side by side (parent: 85980cd)
author | Jonas Fonseca <fonseca@diku.dk> | |
Wed, 16 Mar 2011 01:46:50 +0000 (21:46 -0400) | ||
committer | Jonas Fonseca <fonseca@diku.dk> | |
Thu, 17 Mar 2011 01:21:01 +0000 (21:21 -0400) |
tig.c | patch | blob | history |
index cc9b084dc1c2b1b15b10d7bbf8f5bcb22bafddc0..fd40b8e98027c3aeac5a9c55a130d902c98e102f 100644 (file)
--- a/tig.c
+++ b/tig.c
}
}
+#define refresh_view(view) load_view(view, OPEN_REFRESH)
+
static void
open_view(struct view *prev, enum request request, enum open_flags flags)
{
bool split = !!(flags & OPEN_SPLIT);
- bool reload = !!(flags & (OPEN_RELOAD | OPEN_REFRESH | OPEN_PREPARED));
- bool nomaximize = !!(flags & OPEN_REFRESH);
+ bool reload = !!(flags & (OPEN_RELOAD | OPEN_PREPARED));
struct view *view = VIEW(request);
int nviews = displayed_views();
struct view *base_view = display[0];
+ assert(flags ^ OPEN_REFRESH);
+
if (view == prev && nviews == 1 && !reload) {
report("Already in %s view", view->name);
return;
display[1] = view;
current_view = 1;
view->parent = prev;
- } else if (!nomaximize) {
+ } else {
/* Maximize the current view. */
memset(display, 0, sizeof(display));
current_view = 0;
switch (request) {
case REQ_REFRESH:
load_refs();
- open_view(view, REQ_VIEW_LOG, OPEN_REFRESH);
+ refresh_view(view);
return REQ_NONE;
default:
return pager_request(view, request, line);
if (line->type == LINE_HELP_KEYMAP) {
help_keymap_hidden[line->other] =
!help_keymap_hidden[line->other];
- view->p_restore = TRUE;
- open_view(view, REQ_VIEW_HELP, OPEN_REFRESH);
+ refresh_view(view);
}
return REQ_NONE;
string_copy(opt_file, blame->commit->filename);
if (blame->lineno)
view->lineno = blame->lineno;
- open_view(view, REQ_VIEW_BLAME, OPEN_REFRESH);
+ refresh_view(view);
}
break;
string_copy_rev(opt_ref, blame->commit->parent_id);
string_copy(opt_file, blame->commit->parent_filename);
setup_blame_parent_line(view, blame);
- open_view(view, REQ_VIEW_BLAME, OPEN_REFRESH);
+ refresh_view(view);
}
break;
switch (request) {
case REQ_REFRESH:
load_refs();
- open_view(view, REQ_VIEW_BRANCH, OPEN_REFRESH);
+ refresh_view(view);
return REQ_NONE;
case REQ_TOGGLE_SORT_FIELD:
return request;
}
- open_view(view, REQ_VIEW_STATUS, OPEN_RELOAD);
+ refresh_view(view);
return REQ_NONE;
}
return request;
}
- VIEW(REQ_VIEW_STATUS)->p_restore = TRUE;
- open_view(view, REQ_VIEW_STATUS, OPEN_REFRESH);
+ refresh_view(view->parent);
/* Check whether the staged entry still exists, and close the
* stage view if it doesn't. */
return REQ_VIEW_CLOSE;
}
- open_view(view, REQ_VIEW_STAGE, OPEN_REFRESH);
+ refresh_view(view);
return REQ_NONE;
}
break;
case REQ_REFRESH:
load_refs();
- open_view(view, REQ_VIEW_MAIN, OPEN_REFRESH);
+ refresh_view(view);
break;
default:
return request;