Code

Refactor author drawing into draw_author
authorJonas Fonseca <fonseca@diku.dk>
Fri, 30 Jan 2009 21:46:47 +0000 (22:46 +0100)
committerJonas Fonseca <fonseca@diku.dk>
Mon, 2 Feb 2009 08:17:58 +0000 (09:17 +0100)
tig.c

diff --git a/tig.c b/tig.c
index c569afc52fcfdebc1ffb7a2dbf8e54b9025957c7..b9543707cbea8f546b793060393048db231429f1 100644 (file)
--- a/tig.c
+++ b/tig.c
@@ -2007,6 +2007,12 @@ draw_date(struct view *view, struct tm *time)
        return draw_field(view, LINE_DATE, date, DATE_COLS, FALSE);
 }
 
+static bool
+draw_author(struct view *view, const char *author)
+{
+       return draw_field(view, LINE_MAIN_AUTHOR, author, opt_author_cols, TRUE);
+}
+
 static bool
 draw_view_line(struct view *view, unsigned int lineno)
 {
@@ -3953,8 +3959,7 @@ tree_draw(struct view *view, struct line *line, unsigned int lineno)
                if (draw_field(view, LINE_TREE_MODE, mode, 11, TRUE))
                        return TRUE;
 
-               if (opt_author &&
-                   draw_field(view, LINE_MAIN_AUTHOR, entry->author, opt_author_cols, TRUE))
+               if (opt_author && draw_author(view, entry->author))
                        return TRUE;
 
                if (opt_date && draw_date(view, *entry->author ? &entry->time : NULL))
@@ -4373,8 +4378,7 @@ blame_draw(struct view *view, struct line *line, unsigned int lineno)
        if (opt_date && draw_date(view, time))
                return TRUE;
 
-       if (opt_author &&
-           draw_field(view, LINE_MAIN_AUTHOR, author, opt_author_cols, TRUE))
+       if (opt_author && draw_author(view, author))
                return TRUE;
 
        if (draw_field(view, LINE_BLAME_ID, id, ID_COLS, FALSE))
@@ -5714,8 +5718,7 @@ main_draw(struct view *view, struct line *line, unsigned int lineno)
        if (opt_date && draw_date(view, &commit->time))
                return TRUE;
 
-       if (opt_author &&
-           draw_field(view, LINE_MAIN_AUTHOR, commit->author, opt_author_cols, TRUE))
+       if (opt_author && draw_author(view, commit->author))
                return TRUE;
 
        if (opt_rev_graph && commit->graph_size &&