summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c692b4e)
raw | patch | inline | side by side (parent: c692b4e)
author | Jonas Fonseca <fonseca@diku.dk> | |
Tue, 21 Aug 2007 11:43:53 +0000 (13:43 +0200) | ||
committer | Jonas Fonseca <fonseca@diku.dk> | |
Tue, 21 Aug 2007 11:43:53 +0000 (13:43 +0200) |
tig.c | patch | blob | history |
index 21dd6c2f8e1d7db9862dd03a2a0d15614917edfe..b404f56f1d51a8bac32a814ee43302046f46afc9 100644 (file)
--- a/tig.c
+++ b/tig.c
#define TIG_HELP_CMD ""
#define TIG_PAGER_CMD ""
#define TIG_STATUS_CMD ""
+#define TIG_STAGE_CMD ""
/* Some ascii-shorthands fitted into the ncurses namespace. */
#define KEY_TAB '\t'
REQ_(VIEW_HELP, "Show help page"), \
REQ_(VIEW_PAGER, "Show pager view"), \
REQ_(VIEW_STATUS, "Show status view"), \
+ REQ_(VIEW_STAGE, "Show stage view"), \
\
REQ_GROUP("View manipulation") \
REQ_(ENTER, "Enter current line and scroll"), \
{ 'p', REQ_VIEW_PAGER },
{ 'h', REQ_VIEW_HELP },
{ 'S', REQ_VIEW_STATUS },
+ { 'c', REQ_VIEW_STAGE },
/* View manipulation */
{ 'q', REQ_VIEW_CLOSE },
KEYMAP_(BLOB), \
KEYMAP_(PAGER), \
KEYMAP_(HELP), \
- KEYMAP_(STATUS)
+ KEYMAP_(STATUS), \
+ KEYMAP_(STAGE)
enum keymap {
#define KEYMAP_(name) KEYMAP_##name
static struct view_ops blob_ops;
static struct view_ops help_ops;
static struct view_ops status_ops;
+static struct view_ops stage_ops;
#define VIEW_STR(name, cmd, env, ref, ops, map) \
{ name, cmd, #env, ref, ops, map}
VIEW_(HELP, "help", &help_ops, ""),
VIEW_(PAGER, "pager", &pager_ops, "stdin"),
VIEW_(STATUS, "status", &status_ops, ""),
+ VIEW_(STAGE, "stage", &stage_ops, ""),
};
#define VIEW(req) (&views[(req) - REQ_OFFSET - 1])
open_view(view, request, OPEN_DEFAULT);
break;
+ case REQ_VIEW_STAGE:
+ if (!VIEW(REQ_VIEW_STAGE)->lines) {
+ report("No stage content, press %s to open the status view and choose file",
+ get_key(REQ_VIEW_STATUS));
+ break;
+ }
+ open_view(view, request, OPEN_DEFAULT);
+ break;
+
case REQ_VIEW_MAIN:
case REQ_VIEW_DIFF:
case REQ_VIEW_LOG:
if ((view == VIEW(REQ_VIEW_DIFF) &&
view->parent == VIEW(REQ_VIEW_MAIN)) ||
- (view == VIEW(REQ_VIEW_DIFF) &&
+ (view == VIEW(REQ_VIEW_STAGE) &&
view->parent == VIEW(REQ_VIEW_STATUS)) ||
(view == VIEW(REQ_VIEW_BLOB) &&
view->parent == VIEW(REQ_VIEW_TREE))) {
die("w00t");
}
- open_view(view, REQ_VIEW_DIFF, OPEN_RELOAD | OPEN_SPLIT);
- if (view_is_displayed(VIEW(REQ_VIEW_DIFF))) {
- string_format(VIEW(REQ_VIEW_DIFF)->ref, info, status->name);
+ open_view(view, REQ_VIEW_STAGE, OPEN_RELOAD | OPEN_SPLIT);
+ if (view_is_displayed(VIEW(REQ_VIEW_STAGE))) {
+ string_format(VIEW(REQ_VIEW_STAGE)->ref, info, status->name);
}
return REQ_NONE;
status_select,
};
+static struct view_ops stage_ops = {
+ "line",
+ NULL,
+ pager_read,
+ pager_draw,
+ pager_request,
+ pager_grep,
+ pager_select,
+};
/*
* Revision graph