From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 123A61381F3 for ; Fri, 20 Sep 2013 08:30:57 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 615B4E0BD9; Fri, 20 Sep 2013 08:30:49 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 05A72E0BD9 for ; Fri, 20 Sep 2013 08:30:48 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 1635133ED17 for ; Fri, 20 Sep 2013 08:30:43 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id A6FDCE546C for ; Fri, 20 Sep 2013 08:30:41 +0000 (UTC) From: "Sven Eden" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sven Eden" Message-ID: <1379606187.6c224bde4f19f22c5db934a62282315131ac8ce1.yamakuzure@gentoo> Subject: [gentoo-commits] proj/ufed:master commit in: / X-VCS-Repository: proj/ufed X-VCS-Files: ufed-curses-checklist.c X-VCS-Directories: / X-VCS-Committer: yamakuzure X-VCS-Committer-Name: Sven Eden X-VCS-Revision: 6c224bde4f19f22c5db934a62282315131ac8ce1 X-VCS-Branch: master Date: Fri, 20 Sep 2013 08:30:41 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: d9722e96-83c6-47bd-9d6a-96b6d918e233 X-Archives-Hash: 4448ba01321b114ce76194915df6ef3b commit: 6c224bde4f19f22c5db934a62282315131ac8ce1 Author: Sven Eden gmx net> AuthorDate: Thu Sep 19 15:56:27 2013 +0000 Commit: Sven Eden gmx de> CommitDate: Thu Sep 19 15:56:27 2013 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=6c224bde drawflag(): Advancing the wrapped description part is put to the end of the loop, it is much safer there. --- ufed-curses-checklist.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/ufed-curses-checklist.c b/ufed-curses-checklist.c index b77a6f7..d457c1c 100644 --- a/ufed-curses-checklist.c +++ b/ufed-curses-checklist.c @@ -286,7 +286,7 @@ static int drawflag(sFlag* flag, bool highlight) setFlagWrapDraw(flag, idx, &wrapPart, &pos, &length); // The right side of buf can be added now: - leftover = rightwidth - (int)length - (newDesc ? 0 : 2) - 1; + leftover = rightwidth - (int)length - (newDesc ? 0 : 2); pBuf = &buf[minwidth + (newDesc ? 8 : 10)]; sprintf(pBuf, "%-*.*s", (int)length, (int)length, @@ -295,7 +295,7 @@ static int drawflag(sFlag* flag, bool highlight) // Leftover characters on the right must be blanked: if (leftover > 0) - sprintf(pBuf + length, "%-*sX", leftover, " "); + sprintf(pBuf + length, "%-*s", leftover, " "); /* Set correct color set according to highlighting and status*/ if(highlight) @@ -353,11 +353,19 @@ static int drawflag(sFlag* flag, bool highlight) // Advance counters and possibly description index ++line; ++usedY; - if (NULL == wrapPart) { + + // When wrapping the wrapPart must be advanced and checked + if (eWrap_wrap == e_wrap) { + wrapPart = wrapPart ? wrapPart->next : NULL; + if (wrapPart) + newDesc = false; + else + newDesc = true; + } + + if (newDesc) ++idx; - newDesc = true; - } else - newDesc = false; + } // end of looping flag descriptions if(highlight) @@ -766,8 +774,6 @@ static void setFlagWrapDraw(sFlag* flag, int index, sWrap** wrap, size_t* pos, s if (NULL == wrapPart) wrapPart = flag->desc[index].wrap; - else - wrapPart = wrapPart->next; // The length and position can be written back already if (wrapPart) {