From f2cd17cdbf366aa2c3b22b710c9161cd9b201dff Mon Sep 17 00:00:00 2001 From: Jonas Fonseca Date: Thu, 3 Apr 2008 00:13:42 +0200 Subject: [PATCH] status: use draw_text completely --- tig.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/tig.c b/tig.c index ee9d706..566b8e7 100644 --- a/tig.c +++ b/tig.c @@ -4002,6 +4002,8 @@ static bool status_draw(struct view *view, struct line *line, unsigned int lineno, bool selected) { struct status *status = line->data; + char *text; + int col = 0; wmove(view->win, lineno, 0); @@ -4022,8 +4024,6 @@ status_draw(struct view *view, struct line *line, unsigned int lineno, bool sele } if (!status) { - char *text; - switch (line->type) { case LINE_STAT_STAGED: text = "Changes to be committed:"; @@ -4048,19 +4048,16 @@ status_draw(struct view *view, struct line *line, unsigned int lineno, bool sele default: return FALSE; } + } else { + char buf[] = { status->status, ' ', ' ', ' ', 0 }; - draw_text(view, text, view->width, TRUE, selected); - return TRUE; + col += draw_text(view, buf, view->width, TRUE, selected); + if (!selected) + wattrset(view->win, A_NORMAL); + text = status->new.name; } - waddch(view->win, status->status); - if (!selected) - wattrset(view->win, A_NORMAL); - wmove(view->win, lineno, 4); - if (view->width < 5) - return TRUE; - - draw_text(view, status->new.name, view->width - 5, TRUE, selected); + draw_text(view, text, view->width - col, TRUE, selected); return TRUE; } -- 2.30.2