Code

status: use draw_text completely
authorJonas Fonseca <fonseca@diku.dk>
Wed, 2 Apr 2008 22:13:42 +0000 (00:13 +0200)
committerJonas Fonseca <fonseca@diku.dk>
Wed, 2 Apr 2008 22:13:42 +0000 (00:13 +0200)
tig.c

diff --git a/tig.c b/tig.c
index ee9d70639b05225c69974229b33274dc123d0184..566b8e76dd07b9bfb21837051326fdd8c584130f 100644 (file)
--- 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;
 }