From 8c9f3d7a1888f8de8717c5cb0b66eb0c70a41824 Mon Sep 17 00:00:00 2001 From: Jonas Fonseca Date: Tue, 22 Apr 2014 23:46:46 -0400 Subject: [PATCH] Move ref column drawing to draw_ref --- src/draw.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/draw.c b/src/draw.c index b400403..eda62e3 100644 --- a/src/draw.c +++ b/src/draw.c @@ -309,6 +309,15 @@ draw_lineno(struct view *view, struct view_column *column, unsigned int lineno) } static bool +draw_ref(struct view *view, struct view_column *column, const struct ref *ref) +{ + enum line_type type = !ref || !ref->valid ? LINE_DEFAULT : get_line_type_from_ref(ref); + const char *name = ref ? ref->name : NULL; + + return draw_field(view, type, name, column->width, ALIGN_LEFT, FALSE); +} + +static bool draw_refs(struct view *view, struct view_column *column, const struct ref_list *refs) { size_t i; @@ -449,7 +458,6 @@ view_column_draw(struct view *view, struct line *line, unsigned int lineno) for (; column; column = column->next) { mode_t mode = column_data.mode ? *column_data.mode : 0; - int width = column->width; if (column->hidden) continue; @@ -466,15 +474,9 @@ view_column_draw(struct view *view, struct line *line, unsigned int lineno) continue; case VIEW_COLUMN_REF: - { - const struct ref *ref = column_data.ref; - enum line_type type = !ref || !ref->valid ? LINE_DEFAULT : get_line_type_from_ref(ref); - const char *name = ref ? ref->name : NULL; - - if (draw_field(view, type, name, width, ALIGN_LEFT, FALSE)) + if (draw_ref(view, column, column_data.ref)) return TRUE; continue; - } case VIEW_COLUMN_ID: if (draw_id(view, column, column_data.id)) -- 2.11.4.GIT