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 81AAF138204 for ; Fri, 20 Sep 2013 08:30:42 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 78CD9E0AF8; Fri, 20 Sep 2013 08:30:41 +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 C858CE0AF2 for ; Fri, 20 Sep 2013 08:30:40 +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 D71E833ECAF for ; Fri, 20 Sep 2013 08:30:39 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 8DECCE5460 for ; Fri, 20 Sep 2013 08:30:38 +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: <1379400654.dd3865c8e95cf5ee10fef1c6a0c4ad1b0fbf02cc.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: dd3865c8e95cf5ee10fef1c6a0c4ad1b0fbf02cc X-VCS-Branch: master Date: Fri, 20 Sep 2013 08:30:38 +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: 1eb21716-4d01-4c4a-ae26-2dfd1874b677 X-Archives-Hash: db6c7c61fd18a5b46bc907d614ac66e0 commit: dd3865c8e95cf5ee10fef1c6a0c4ad1b0fbf02cc Author: Sven Eden gmx net> AuthorDate: Tue Sep 17 06:50:54 2013 +0000 Commit: Sven Eden gmx de> CommitDate: Tue Sep 17 06:50:54 2013 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=dd3865c8 drawFlag(): Added skipping of individual wrapped description parts when searching the start of a flag with enabled description wrapping. --- ufed-curses-checklist.c | 53 +++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 43 insertions(+), 10 deletions(-) diff --git a/ufed-curses-checklist.c b/ufed-curses-checklist.c index f55cf66..9aaf35f 100644 --- a/ufed-curses-checklist.c +++ b/ufed-curses-checklist.c @@ -202,11 +202,12 @@ static void free_flags(void) static int drawflag(sFlag* flag, bool highlight) { - int idx = 0; - int usedY = 0; - int line = flag->currline; - char buf[wWidth(List)+1]; - char desc[maxDescWidth]; + int idx = 0; + int usedY = 0; + int line = flag->currline; + char buf[wWidth(List)+1]; + char desc[maxDescWidth]; + sWrap* wrapPart = NULL; // Return early if there is nothing to display: if (!isFlagLegal(flag)) @@ -216,15 +217,47 @@ static int drawflag(sFlag* flag, bool highlight) * Overly long description lists might not fit on one screen, * and therefore must be scrolled instead of the flags * themselves. + * If descriptions are wrapped, any description must be held + * until wrapPart is either NULL, or a part on the screen is + * reached. */ if (line < 0) { if (-line < getFlagHeight(flag)) { while (line < 0) { - if (isDescLegal(flag, idx++)) { - ++line; - ++usedY; - } - } + if (isDescLegal(flag, idx)) { + if (eWrap_normal == e_wrap) { + ++line; + ++usedY; + ++idx; + } else { + /* With wrapped descriptions there are two possible + * situations: + * a) The list of wrapped lines is shorter than the + * lines to be skipped to get this description on + * the screen. In this case the full description + * can be fast forwareded. + * b) The number of lines above the screen is less + * than the number of wrapped parts. In this case + * the first on screen part must be found. + */ + int wrapCount = flag->desc[idx].wrapCount; + wrapPart = flag->desc[idx].wrap; + if (wrapPart && wrapCount && (-line < wrapCount)) { + // Situation b) This description enters screen + while (wrapPart && (line < 0)) { + ++line; + ++usedY; + wrapPart = wrapPart->next; + } + } else { + // Situation a) Fast forward + line += wrapCount; + usedY += wrapCount; + ++idx; + } + } // End of handling wrapped lines + } // End of having a legal flag + } // end of moving to line 0 } else // Otherwise this item is out of the display area return 0;