From d52d839f5016f52dd09a3a309697b2696a28de5f Mon Sep 17 00:00:00 2001 From: Jonas Fonseca Date: Fri, 30 Jan 2009 22:46:47 +0100 Subject: [PATCH] Refactor author drawing into draw_author --- tig.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/tig.c b/tig.c index c569afc..b954370 100644 --- 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 && -- 2.30.2