summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: d6c429b)
raw | patch | inline | side by side (parent: d6c429b)
author | Jonas Fonseca <fonseca@diku.dk> | |
Tue, 7 Oct 2008 10:08:54 +0000 (12:08 +0200) | ||
committer | Jonas Fonseca <fonseca@diku.dk> | |
Tue, 7 Oct 2008 10:09:54 +0000 (12:09 +0200) |
tig.c | patch | blob | history |
index 2fff94e61b666bed37f66a989a386a5d4b0b629c..6e32e227c5fb68110959da277be785cd778d4ee0 100644 (file)
--- a/tig.c
+++ b/tig.c
}
static bool
-begin_update(struct view *view)
+begin_update(struct view *view, bool refresh)
{
if (opt_cmd[0]) {
string_copy(view->cmd, opt_cmd);
if (!string_format(view->cmd, format, view->id, path))
return FALSE;
- } else {
+ } else if (!refresh) {
const char *format = view->cmd_env ? view->cmd_env : view->cmd_fmt;
const char *id = view->id;
OPEN_SPLIT = 1, /* Split current view. */
OPEN_BACKGROUNDED = 2, /* Backgrounded. */
OPEN_RELOAD = 4, /* Reload view even if it is the current. */
- OPEN_NOMAXIMIZE = 8 /* Do not maximize the current view. */
+ OPEN_NOMAXIMIZE = 8, /* Do not maximize the current view. */
+ OPEN_REFRESH = 16, /* Refresh view using previous command. */
};
static void
{
bool backgrounded = !!(flags & OPEN_BACKGROUNDED);
bool split = !!(flags & OPEN_SPLIT);
- bool reload = !!(flags & OPEN_RELOAD);
+ bool reload = !!(flags & (OPEN_RELOAD | OPEN_REFRESH));
bool nomaximize = !!(flags & OPEN_NOMAXIMIZE);
struct view *view = VIEW(request);
int nviews = displayed_views();
}
} else if ((reload || strcmp(view->vid, view->id)) &&
- !begin_update(view)) {
+ !begin_update(view, flags & OPEN_REFRESH)) {
report("Failed to load %s view", view->name);
return;
}
if (stage_line_type == LINE_STAT_UNTRACKED)
opt_pipe = fopen(stage_status.new.name, "r");
- else
- string_copy(opt_cmd, view->cmd);
- open_view(view, REQ_VIEW_STAGE, OPEN_RELOAD | OPEN_NOMAXIMIZE);
+ open_view(view, REQ_VIEW_STAGE, OPEN_REFRESH | OPEN_NOMAXIMIZE);
return REQ_NONE;
}
break;
case REQ_REFRESH:
load_refs();
- string_copy(opt_cmd, view->cmd);
- open_view(view, REQ_VIEW_MAIN, OPEN_RELOAD);
+ open_view(view, REQ_VIEW_MAIN, OPEN_REFRESH);
break;
default:
return request;