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 4CD251381F3 for ; Fri, 20 Sep 2013 08:31:01 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id E5C58E0BE1; Fri, 20 Sep 2013 08:30:59 +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 2999BE0BE0 for ; Fri, 20 Sep 2013 08:30:49 +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 10CE733ECCD 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 4666BE546A 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: <1379604703.af1f923685f26a000dc191a3db9c6ec85ff8557c.yamakuzure@gentoo> Subject: [gentoo-commits] proj/ufed:master commit in: / X-VCS-Repository: proj/ufed X-VCS-Files: ufed-curses-checklist.c ufed-curses-types.c X-VCS-Directories: / X-VCS-Committer: yamakuzure X-VCS-Committer-Name: Sven Eden X-VCS-Revision: af1f923685f26a000dc191a3db9c6ec85ff8557c 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: 3c4228ec-e1c4-4a5b-aedf-1e1db66b7f39 X-Archives-Hash: ee46bc2806e4360e9ce83053d6153d22 commit: af1f923685f26a000dc191a3db9c6ec85ff8557c Author: Sven Eden gmx net> AuthorDate: Thu Sep 19 15:31:43 2013 +0000 Commit: Sven Eden gmx de> CommitDate: Thu Sep 19 15:31:43 2013 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=af1f9236 calculateDescWrap() is no aware of the brackets that are drawn around the package lists --- ufed-curses-checklist.c | 18 ++++++------------ ufed-curses-types.c | 9 +++++++++ 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/ufed-curses-checklist.c b/ufed-curses-checklist.c index b82e9f0..9dff8e2 100644 --- a/ufed-curses-checklist.c +++ b/ufed-curses-checklist.c @@ -220,8 +220,6 @@ static int drawflag(sFlag* flag, bool highlight) desc[maxDescWidth] = 0x0; // Description and wrapped lines state values - bool hasBlankLeft = false; // Set to true once the left side is blanked - bool hasBlankRight = false; // Set to true once the right (state) side is blanked bool hasHead = false; // Set to true once the left side (flag name and states) are printed int rightwidth = lWidth - minwidth - 8; // Space on the right to print descriptions size_t length = rightwidth; // Characters to print when not wrapping @@ -246,17 +244,16 @@ static int drawflag(sFlag* flag, bool highlight) continue; } - // If the flag name and state are drawn, following lines - // need to start with spaces - if (hasHead && !hasBlankLeft) { - memset(buf, ' ', minwidth); - hasBlankLeft = true; - } + // Always start with a blanked buffer + memset(buf, ' ', sizeof(char) * lWidth); // Prepare new description or blank on wrapped parts if (newDesc) { special = getFlagSpecialChar(flag, idx); + // Always start with a blank description buffer + memset(desc, ' ', sizeof(char) * maxDescWidth); + // Wrapped and not wrapped lines are unified here // to simplify the usage of different ordering and // stripped descriptions versus original descriptions @@ -272,9 +269,6 @@ static int drawflag(sFlag* flag, bool highlight) flag->desc[idx].pkg); } else sprintf(desc, "%s", flag->desc[idx].desc); - } else if (!hasBlankRight) { - memset(buf + minwidth, ' ', 10); - hasBlankRight = true; } /* --- Preparations done --- */ @@ -293,7 +287,7 @@ static int drawflag(sFlag* flag, bool highlight) // The right side of buf can be added now: leftover = rightwidth - (int)length; - pBuf = buf + minwidth + (newDesc ? 8 : 10); + pBuf = &buf[minwidth + (newDesc ? 8 : 10)]; sprintf(pBuf, "%-*.*s", (int)length, (int)length, strlen(desc) > pos ? &desc[pos] : " "); diff --git a/ufed-curses-types.c b/ufed-curses-types.c index 4a5445f..14c9313 100644 --- a/ufed-curses-types.c +++ b/ufed-curses-types.c @@ -595,6 +595,15 @@ static void calculateDescWrap(sDesc* desc) --left; } + // Correct length if this is the package list + // Note: in drawflag() the string is pre- and postfixed with '(' / ')' + if (pch == pPkg) { + if (!curr->pos) + ++curr->len; + if (end >= (wLen - 1)) + ++curr->len; + } + // Step 4: Switch if the current string is exhausted: if (left && (!wLen || (end >= (wLen - 1)) || (start >= wLen) ) ) {