summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 2b594d1)
raw | patch | inline | side by side (parent: 2b594d1)
author | Jonas Fonseca <fonseca@diku.dk> | |
Tue, 6 Feb 2007 14:40:28 +0000 (15:40 +0100) | ||
committer | Jonas Fonseca <fonseca@diku.dk> | |
Tue, 6 Feb 2007 14:40:28 +0000 (15:40 +0100) |
Hightlight remotes similar to how tags are highlighted.
Colors are configurable via main-remote.
Colors are configurable via main-remote.
tig.c | patch | blob | history | |
tigrc.5.txt | patch | blob | history |
index ebd7abeafa5c368da25dcdab6aae76355d645b99..affbcec1bd520248604a337524b2e5e6caf3ecdc 100644 (file)
--- a/tig.c
+++ b/tig.c
char *name; /* Ref name; tag or head names are shortened. */
char id[SIZEOF_REV]; /* Commit SHA1 ID */
unsigned int tag:1; /* Is it a tag? */
+ unsigned int remote:1; /* Is it a remote ref? */
unsigned int next:1; /* For ref lists: are there more refs? */
};
LINE(MAIN_COMMIT, "", COLOR_DEFAULT, COLOR_DEFAULT, 0), \
LINE(MAIN_DELIM, "", COLOR_MAGENTA, COLOR_DEFAULT, 0), \
LINE(MAIN_TAG, "", COLOR_MAGENTA, COLOR_DEFAULT, A_BOLD), \
+LINE(MAIN_REMOTE, "", COLOR_YELLOW, COLOR_DEFAULT, A_BOLD), \
LINE(MAIN_REF, "", COLOR_CYAN, COLOR_DEFAULT, A_BOLD), \
LINE(TREE_DIR, "", COLOR_DEFAULT, COLOR_DEFAULT, A_NORMAL), \
LINE(TREE_FILE, "", COLOR_DEFAULT, COLOR_DEFAULT, A_NORMAL)
do {
struct ref *ref = refs[refpos];
- char *fmt = ref->tag ? "%s[%s]" : "%s%s";
+ char *fmt = ref->tag ? "%s[%s]" :
+ ref->remote ? "%s<%s>" : "%s%s";
if (!string_format_from(buf, &bufpos, fmt, sep, ref->name))
return;
@@ -2771,6 +2774,8 @@ main_draw(struct view *view, struct line *line, unsigned int lineno, bool select
;
else if (commit->refs[i]->tag)
wattrset(view->win, get_line_attr(LINE_MAIN_TAG));
+ else if (commit->refs[i]->remote)
+ wattrset(view->win, get_line_attr(LINE_MAIN_REMOTE));
else
wattrset(view->win, get_line_attr(LINE_MAIN_REF));
waddstr(view->win, "[");
{
struct ref *ref;
bool tag = FALSE;
+ bool remote = FALSE;
if (!strncmp(name, "refs/tags/", STRING_SIZE("refs/tags/"))) {
/* Commits referenced by tags has "^{}" appended. */
namelen -= STRING_SIZE("refs/tags/");
name += STRING_SIZE("refs/tags/");
+ } else if (!strncmp(name, "refs/remotes/", STRING_SIZE("refs/remotes/"))) {
+ remote = TRUE;
+ namelen -= STRING_SIZE("refs/remotes/");
+ name += STRING_SIZE("refs/remotes/");
+
} else if (!strncmp(name, "refs/heads/", STRING_SIZE("refs/heads/"))) {
namelen -= STRING_SIZE("refs/heads/");
name += STRING_SIZE("refs/heads/");
strncpy(ref->name, name, namelen);
ref->name[namelen] = 0;
ref->tag = tag;
+ ref->remote = remote;
string_copy(ref->id, id);
return OK;
diff --git a/tigrc.5.txt b/tigrc.5.txt
index 1b1df676c65f2e3fbee7d480f3ab65a6ed91faf7..a3bee01f13defe78ab7cd48f3207f536b25a1e44 100644 (file)
--- a/tigrc.5.txt
+++ b/tigrc.5.txt
delimiting long author names and labels for tag and branch references.
*main-date*, *main-author*, *main-commit*, *main-delim*, *main-tag*,
-*main-ref*
+*main-ref*, *main-remote*
--