From 8b27c17815d2fc623f59055422323c953aedac74 Mon Sep 17 00:00:00 2001 From: Jonas Fonseca Date: Thu, 22 Jan 2009 17:00:45 +0100 Subject: [PATCH] Fix status_exists to be consistent with data displayed in the stage view --- tig.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) 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; -- 2.30.2