summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: d52d839)
raw | patch | inline | side by side (parent: d52d839)
author | Jonas Fonseca <fonseca@diku.dk> | |
Fri, 30 Jan 2009 23:49:25 +0000 (00:49 +0100) | ||
committer | Jonas Fonseca <fonseca@diku.dk> | |
Mon, 2 Feb 2009 08:17:58 +0000 (09:17 +0100) |
NEWS | patch | blob | history | |
TODO | patch | blob | history | |
tig.c | patch | blob | history | |
tigrc.5.txt | patch | blob | history |
index c8d080b05f703ff46185ec5323a2c576d07eebd5..de00136e74e331ab7e580fbd3bd50b8d94f4913a 100644 (file)
--- a/NEWS
+++ b/NEWS
- Stage & main view: restore view position when reloading.
- Blame view: load blame for parent commit. For merge commits the parent
is queried. Bound to ',' by default via the existing "parent" action.
+ - Abbreviate author names to initials when the width of the author column
+ is below 6 characters.
Bug fixes:
index 651b92cecfb803c56f7d9bd5198e861014dbf227..374b173a21fea3235a35e0a98f7498816cfaf836 100644 (file)
--- a/TODO
+++ b/TODO
- Color the revgraph to make it easier to follow branches. Idea by
Dominik Vogt.
- - Blame view: Allow names in the author column to be abbreviated to
- initials. Will optimize screen usage for the blame view.
-
- Commit cache: Many views use commit information and load it into
their own custom data structure. Having the information shared would
make it easier to do various interesting stuff across the views.
index b9543707cbea8f546b793060393048db231429f1..90e03735ef9a1be09901bd85d6f0b71c0ce81d9b 100644 (file)
--- a/tig.c
+++ b/tig.c
static bool
draw_author(struct view *view, const char *author)
{
- return draw_field(view, LINE_MAIN_AUTHOR, author, opt_author_cols, TRUE);
+ bool trim = opt_author_cols == 0 || opt_author_cols > 5 || !author;
+
+ if (!trim) {
+ static char initials[10];
+ size_t pos;
+
+#define is_initial_sep(c) (isspace(c) || ispunct(c) || (c) == '@')
+
+ memset(initials, 0, sizeof(initials));
+ for (pos = 0; *author && pos < opt_author_cols - 1; author++, pos++) {
+ while (is_initial_sep(*author))
+ author++;
+ strncpy(&initials[pos], author, sizeof(initials) - 1 - pos);
+ while (*author && !is_initial_sep(author[1]))
+ author++;
+ }
+
+ author = initials;
+ }
+
+ return draw_field(view, LINE_MAIN_AUTHOR, author, opt_author_cols, trim);
}
static bool
diff --git a/tigrc.5.txt b/tigrc.5.txt
index 0090ca770d7ae25758368be225fa8643652b38f7..1120a8642b6c817f833db9ef91f258729fdb5b8a 100644 (file)
--- a/tigrc.5.txt
+++ b/tigrc.5.txt
'author-width' (int)::
- Width of the author column.
+ Width of the author column. When set to 5 or below, the author name
+ will be abbreviated to the author's initials.
'line-graphics' (bool)::