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 C0DE51384E0 for ; Wed, 16 Jan 2013 12:56:54 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 6383F21C049; Wed, 16 Jan 2013 12:56:48 +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 71CA821C049 for ; Wed, 16 Jan 2013 12:56:47 +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 4809F33D806 for ; Wed, 16 Jan 2013 12:56:46 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id D5679E4089 for ; Wed, 16 Jan 2013 12:56:44 +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: <1358326651.10f0d42fa883ece4b2afc6be2eafb29f7cdf9a62.yamakuzure@gentoo> Subject: [gentoo-commits] proj/ufed:master commit in: / X-VCS-Repository: proj/ufed X-VCS-Files: ufed-curses-checklist.c ufed-curses.c X-VCS-Directories: / X-VCS-Committer: yamakuzure X-VCS-Committer-Name: Sven Eden X-VCS-Revision: 10f0d42fa883ece4b2afc6be2eafb29f7cdf9a62 X-VCS-Branch: master Date: Wed, 16 Jan 2013 12:56:44 +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: fbd4b861-7515-4a08-9a5a-c423e75f4aa8 X-Archives-Hash: acf4d17cfa8fce7c96bf92a2ad2c69e6 commit: 10f0d42fa883ece4b2afc6be2eafb29f7cdf9a62 Author: Sven Eden gmx de> AuthorDate: Wed Jan 16 08:57:31 2013 +0000 Commit: Sven Eden gmx de> CommitDate: Wed Jan 16 08:57:31 2013 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=10f0d42f Added checks to disallow breaking the masked/unmasked flag filtering using PGUP, PGDN, HOME, END or the flag search by keywords. This is a preparation to finally add a masked flag display toggle. --- ufed-curses-checklist.c | 22 ++++++++++++++++++---- ufed-curses.c | 28 +++++++++++++++++++++------- 2 files changed, 39 insertions(+), 11 deletions(-) diff --git a/ufed-curses-checklist.c b/ufed-curses-checklist.c index b43ecac..2f3432d 100644 --- a/ufed-curses-checklist.c +++ b/ufed-curses-checklist.c @@ -262,14 +262,28 @@ static int callback(struct item **currentitem, int key) { faytsave[n] = *currentitem; n++; fayt[n] = '\0'; + + /* if the current flag already matches the input string, + * then update the input area only. + */ if(strncasecmp(((struct flag *) item)->name, fayt, n)==0) { wattrset(win(Input), COLOR_PAIR(3) | A_BOLD); mvwaddstr(win(Input), 0, 0, fayt); wrefresh(win(Input)); - } else { + } + /* if the current flag does not match, search one that does. */ + else { do item = item->next; while(item!=*currentitem && strncasecmp(((struct flag *) item)->name, fayt, n)!=0); - if(item==*currentitem) { + + /* if there was no match (or the match is filtered), + * update the input area to show that there is no match + */ + if ( (item == *currentitem) + || ( item->isMasked && (show_unmasked == showMasked)) + || (!item->isMasked && (show_masked == showMasked)) ) { + if (item != *currentitem) + item = *currentitem; wattrset(win(Input), COLOR_PAIR(4) | A_BOLD | A_REVERSE); mvwaddstr(win(Input), 0, 0, fayt); wmove(win(Input), 0, n-1); @@ -322,7 +336,7 @@ static int callback(struct item **currentitem, int key) { break; case ' ': { // do not toggle masked flags using the keyboard - if ('m' == ((struct flag *) *currentitem)->on) + if ((*currentitem)->isMasked) break; // Not masked? Then cycle through the states. switch (((struct flag *) *currentitem)->on) { @@ -361,7 +375,7 @@ static int callback(struct item **currentitem, int key) { #ifdef NCURSES_MOUSE_VERSION case KEY_MOUSE: // do not toggle masked flags using the double click - if ('m' == ((struct flag *) *currentitem)->on) + if ((*currentitem)->isMasked) break; // Not masked? Then cycle through the states. switch (((struct flag *) *currentitem)->on) { diff --git a/ufed-curses.c b/ufed-curses.c index 65c4ba8..edaef38 100644 --- a/ufed-curses.c +++ b/ufed-curses.c @@ -497,9 +497,12 @@ int maineventloop( if(currentitem!=items) { struct item *olditem = currentitem; (*drawitem)(currentitem, FALSE); - do currentitem = currentitem->prev; - while(currentitem!=items - && olditem->top - currentitem->prev->top <= wHeight(List)); + while( (currentitem != items) + && ( (olditem->top - currentitem->prev->top) <= wHeight(List)) + && ( ( !currentitem->prev->isMasked + || (show_unmasked != showMasked)) ) ) { + currentitem = currentitem->prev; + } scrollcurrent(); (*drawitem)(currentitem, TRUE); } @@ -509,10 +512,13 @@ int maineventloop( if(currentitem->next!=items) { struct item *olditem = currentitem; (*drawitem)(currentitem, FALSE); - do currentitem = currentitem->next; - while(currentitem->next!=items - && (currentitem->next->top + currentitem->next->height) - - (olditem->top + olditem->height) <= wHeight(List)); + while( (currentitem->next != items) + && (((currentitem->next->top + currentitem->next->height) + -(olditem->top + olditem->height) ) <= wHeight(List)) + && ( ( currentitem->next->isMasked + || (show_masked != showMasked)) ) ) { + currentitem = currentitem->next; + } scrollcurrent(); (*drawitem)(currentitem, TRUE); } @@ -522,6 +528,10 @@ int maineventloop( if(currentitem!=items) { (*drawitem)(currentitem, FALSE); currentitem = items; + if (show_unmasked == showMasked) { + while (currentitem->isMasked) + currentitem = currentitem->next; + } scrollcurrent(); (*drawitem)(currentitem, TRUE); } @@ -531,6 +541,10 @@ int maineventloop( if(currentitem->next!=items) { (*drawitem)(currentitem, FALSE); currentitem = items->prev; + if (show_masked == showMasked) { + while (!currentitem->isMasked) + currentitem = currentitem->prev; + } scrollcurrent(); (*drawitem)(currentitem, TRUE); }