summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: b206672)
raw | patch | inline | side by side (parent: b206672)
author | Jonas Fonseca <fonseca@diku.dk> | |
Mon, 12 Apr 2010 02:42:52 +0000 (22:42 -0400) | ||
committer | Jonas Fonseca <fonseca@diku.dk> | |
Thu, 15 Apr 2010 11:20:17 +0000 (07:20 -0400) |
tig.c | patch | blob | history |
index cd3428cc38c29f783bdbc12800f3dd5ad26d86bf..9a4a75174f120042ae84ba17ba6c9309b2de8de6 100644 (file)
--- a/tig.c
+++ b/tig.c
enum keymap keymap; /* What keymap does this view have */
bool git_dir; /* Whether the view requires a git directory. */
+ bool refresh; /* Whether the view supports refreshing. */
char ref[SIZEOF_REF]; /* Hovered commit reference */
char vid[SIZEOF_REF]; /* View ID. Set to id member when updating. */
static struct view_ops tree_ops;
static struct view_ops branch_ops;
-#define VIEW_STR(name, env, ref, ops, map, git) \
- { name, #env, ref, ops, map, git }
-
-#define VIEW_(id, name, ops, git, ref) \
- VIEW_STR(name, TIG_##id##_CMD, ref, ops, KEYMAP_##id, git)
+#define VIEW_STR(name, env, ref, ops, map, git, refresh) \
+ { name, #env, ref, ops, map, git, refresh }
+#define VIEW_(id, name, ops, git, refresh, ref) \
+ VIEW_STR(name, TIG_##id##_CMD, ref, ops, KEYMAP_##id, git, refresh)
static struct view views[] = {
- VIEW_(MAIN, "main", &main_ops, TRUE, ref_head),
- VIEW_(DIFF, "diff", &diff_ops, TRUE, ref_commit),
- VIEW_(LOG, "log", &log_ops, TRUE, ref_head),
- VIEW_(TREE, "tree", &tree_ops, TRUE, ref_commit),
- VIEW_(BLOB, "blob", &blob_ops, TRUE, ref_blob),
- VIEW_(BLAME, "blame", &blame_ops, TRUE, ref_commit),
- VIEW_(BRANCH, "branch", &branch_ops, TRUE, ref_head),
- VIEW_(HELP, "help", &help_ops, FALSE, ""),
- VIEW_(PAGER, "pager", &pager_ops, FALSE, "stdin"),
- VIEW_(STATUS, "status", &status_ops, TRUE, ""),
- VIEW_(STAGE, "stage", &stage_ops, TRUE, ""),
+ VIEW_(MAIN, "main", &main_ops, TRUE, TRUE, ref_head),
+ VIEW_(DIFF, "diff", &diff_ops, TRUE, FALSE, ref_commit),
+ VIEW_(LOG, "log", &log_ops, TRUE, TRUE, ref_head),
+ VIEW_(TREE, "tree", &tree_ops, TRUE, FALSE, ref_commit),
+ VIEW_(BLOB, "blob", &blob_ops, TRUE, FALSE, ref_blob),
+ VIEW_(BLAME, "blame", &blame_ops, TRUE, FALSE, ref_commit),
+ VIEW_(BRANCH, "branch", &branch_ops, TRUE, TRUE, ref_head),
+ VIEW_(HELP, "help", &help_ops, FALSE, FALSE, ""),
+ VIEW_(PAGER, "pager", &pager_ops, FALSE, FALSE, "stdin"),
+ VIEW_(STATUS, "status", &status_ops, TRUE, TRUE, ""),
+ VIEW_(STAGE, "stage", &stage_ops, TRUE, TRUE, ""),
};
#define VIEW(req) (&views[(req) - REQ_OFFSET - 1])
if (request > REQ_NONE) {
open_run_request(request);
/* FIXME: When all views can refresh always do this. */
- if (view == VIEW(REQ_VIEW_STATUS) ||
- view == VIEW(REQ_VIEW_MAIN) ||
- view == VIEW(REQ_VIEW_LOG) ||
- view == VIEW(REQ_VIEW_BRANCH) ||
- view == VIEW(REQ_VIEW_STAGE))
+ if (view->refresh)
request = REQ_REFRESH;
else
return TRUE;