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 AE5C11381F3 for ; Fri, 20 Sep 2013 08:30:59 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id C7DEEE0BD7; Fri, 20 Sep 2013 08:30:44 +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 65AA1E0BD7 for ; Fri, 20 Sep 2013 08:30:44 +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 77B2C33ED20 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 2F593E530A for ; Fri, 20 Sep 2013 08:30:42 +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: <1379612176.c69b9f7f923729e1663d75d9ab3378c4ec67e5ad.yamakuzure@gentoo> Subject: [gentoo-commits] proj/ufed:master commit in: / X-VCS-Repository: proj/ufed X-VCS-Files: ufed-curses-types.c X-VCS-Directories: / X-VCS-Committer: yamakuzure X-VCS-Committer-Name: Sven Eden X-VCS-Revision: c69b9f7f923729e1663d75d9ab3378c4ec67e5ad X-VCS-Branch: master Date: Fri, 20 Sep 2013 08:30:42 +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: 06262e50-da92-4a8d-90dd-07591a107ddb X-Archives-Hash: 44ac452eb5da69656ac942102206b722 commit: c69b9f7f923729e1663d75d9ab3378c4ec67e5ad Author: Sven Eden gmx net> AuthorDate: Thu Sep 19 17:36:16 2013 +0000 Commit: Sven Eden gmx de> CommitDate: Thu Sep 19 17:36:16 2013 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=c69b9f7f calculateDescWrap(): Take later pre-/postfixing of brackets of the package list into account when setting the next wrap part. --- ufed-curses-types.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/ufed-curses-types.c b/ufed-curses-types.c index fad7b2d..1a30392 100644 --- a/ufed-curses-types.c +++ b/ufed-curses-types.c @@ -570,7 +570,25 @@ static void calculateDescWrap(sDesc* desc) while (left) { // Step 1: Set current wrap part end - end = start + width + (curr == desc->wrap ? 2 : 0); + end = start + width; + + // First line has two more spaces: + if (curr == desc->wrap) + end += 2; + + // Package lists have one space less in their first line, + // because an opening bracket is prefixed by drawflag(), + // and two spaces less in their last line, because another + // bracked is postfixed and the leading whitespace is + // skipped below. + if (pch == pPkg) { + if (!start || (start == oLen)) + --end; + else if (end >= (wLen - 1)) + end -= 2; + } + + // Don't shoot over the target! if (end >= wLen) end = wLen - 1; @@ -584,7 +602,7 @@ static void calculateDescWrap(sDesc* desc) // Step 3: Note values and increase start curr->pos = start + oLen; - curr->len = end - start + (' ' == pch[end] ? 0 : 1); + curr->len = end - start + (end == (wLen - 1) ? 1 : 0); start += curr->len; left -= curr->len; ++desc->wrapCount;