From 5e74a1084a35f8ebe312c4af63e13a468f410886 Mon Sep 17 00:00:00 2001 From: Sven Eden Date: Wed, 18 Sep 2013 21:22:49 +0200 Subject: drawFlag() fixed a definite endless loop --- ufed-curses-checklist.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'ufed-curses-checklist.c') diff --git a/ufed-curses-checklist.c b/ufed-curses-checklist.c index b5eef00..2ac712b 100644 --- a/ufed-curses-checklist.c +++ b/ufed-curses-checklist.c @@ -185,6 +185,7 @@ static void read_flags(void) bottomline = lineNum; } + static int drawflag(sFlag* flag, bool highlight) { // Return early if there is nothing to display: @@ -236,8 +237,10 @@ static int drawflag(sFlag* flag, bool highlight) while ( (idx < flag->ndesc) && (line < lHeight) ) { // Continue if any of the filters apply: - if (newDesc && !isDescLegal(flag, idx)) + if (newDesc && !isDescLegal(flag, idx)) { + ++idx; continue; + } // If the flag name and state are drawn, following lines // need to start with spaces @@ -274,7 +277,7 @@ static int drawflag(sFlag* flag, bool highlight) // 1: Print left side info if (!hasHead || newDesc) - // Note: If either is false, the buffer is blanked already + // Note: If both are false, the buffer is blanked already printFlagInfo(buf, flag, idx, !hasHead, newDesc); // At this point buf is guaranteed to be filled up to minwidth + 8 @@ -284,6 +287,8 @@ static int drawflag(sFlag* flag, bool highlight) if (eWrap_wrap == e_wrap) { setFlagWrapDraw(flag, idx, &wrapPart, &pos, &length, &wrapFirst); wrapPart = wrapPart->next; + if (newDesc && wrapPart) + newDesc = false; } // The right side of buf can be added now: -- cgit v1.2.3-65-gdbad