From: Jonas Fonseca Date: Thu, 22 Jan 2009 16:00:45 +0000 (+0100) Subject: Fix status_exists to be consistent with data displayed in the stage view X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=8b27c17815d2fc623f59055422323c953aedac74;p=tig.git Fix status_exists to be consistent with data displayed in the stage view --- diff --git a/tig.c b/tig.c index 0e1028a..2380332 100644 --- a/tig.c +++ b/tig.c @@ -4568,17 +4568,22 @@ static bool status_exists(struct status *status, enum line_type type) { struct view *view = VIEW(REQ_VIEW_STATUS); - struct line *line; + unsigned long lineno; - for (line = view->line; line < view->line + view->lines; line++) { + for (lineno = 0; lineno < view->lines; lineno++) { + struct line *line = &view->line[lineno]; struct status *pos = line->data; if (line->type != type) continue; - if (!pos && (!status || !status->status)) + if (!pos && (!status || !status->status) && line[1].data) { + select_view_line(view, lineno); return TRUE; - if (pos && !strcmp(status->new.name, pos->new.name)) + } + if (pos && !strcmp(status->new.name, pos->new.name)) { + select_view_line(view, lineno); return TRUE; + } } return FALSE;