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 ABC331389C0 for ; Tue, 12 Feb 2013 09:01:47 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 7691321C07F; Tue, 12 Feb 2013 09:01:34 +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 B539121C07F for ; Tue, 12 Feb 2013 09:01:28 +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 84C9233E6AD for ; Tue, 12 Feb 2013 09:01:23 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 117F7E40A7 for ; Tue, 12 Feb 2013 09:01:20 +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: <1360659661.ccdb50aa4d5271ee5b9633be453fc497375ed313.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: ccdb50aa4d5271ee5b9633be453fc497375ed313 X-VCS-Branch: master Date: Tue, 12 Feb 2013 09:01:20 +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: 4b96a4fb-9cbe-4647-b79d-8ea587b9314a X-Archives-Hash: 30b9d8d113ca7d374d6f7a684f4a847d commit: ccdb50aa4d5271ee5b9633be453fc497375ed313 Author: Sven Eden gmx de> AuthorDate: Tue Feb 12 09:01:01 2013 +0000 Commit: Sven Eden gmx de> CommitDate: Tue Feb 12 09:01:01 2013 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/ufed.git;a=commit;h=ccdb50aa Instead of trying to hide the cursor, it is now placed in the input line (where it belongs). --- ufed-curses-checklist.c | 50 ++++++++++++++++++++++++++++++++++------------ ufed-curses.c | 20 ++++++++++-------- 2 files changed, 48 insertions(+), 22 deletions(-) diff --git a/ufed-curses-checklist.c b/ufed-curses-checklist.c index b5e3ee3..ebf25e7 100644 --- a/ufed-curses-checklist.c +++ b/ufed-curses-checklist.c @@ -13,7 +13,6 @@ /* internal members */ static int descriptionleft = 0; -static char* fayt = NULL; static sFlag** faytsave = NULL; static size_t maxDescWidth = 0; static char* lineBuf = NULL; @@ -318,13 +317,22 @@ static int drawflag(sFlag* flag, bool highlight) if (!hasHead) { hasHead = true; if (flag->globalForced) { - wattrset(wLst, COLOR_PAIR(5) | A_BOLD); + if(highlight) + wattrset(wLst, COLOR_PAIR(5) | A_REVERSE); + else + wattrset(wLst, COLOR_PAIR(5) | A_BOLD); mvwaddch(wLst, line, 2, '+'); } else if (flag->globalMasked) { - wattrset(wLst, COLOR_PAIR(4) | A_BOLD); + if(highlight) + wattrset(wLst, COLOR_PAIR(4) | A_REVERSE); + else + wattrset(wLst, COLOR_PAIR(4) | A_BOLD); mvwaddch(wLst, line, 2, '-'); } else if (' ' == flag->stateConf) { - wattrset(wLst, COLOR_PAIR(3) | A_BOLD); + if(highlight) + wattrset(wLst, COLOR_PAIR(3) | A_REVERSE); + else + wattrset(wLst, COLOR_PAIR(3) | A_BOLD); mvwaddch(wLst, line, 2, flag->stateDefault); } else mvwaddch(wLst, line, 2, flag->stateConf); @@ -332,13 +340,22 @@ static int drawflag(sFlag* flag, bool highlight) // Add [D]efault column content if ('f' == special) { - wattrset(wLst, COLOR_PAIR(5) | A_BOLD); + if(highlight) + wattrset(wLst, COLOR_PAIR(5) | A_REVERSE); + else + wattrset(wLst, COLOR_PAIR(5) | A_BOLD); mvwaddch(wLst, line, minwidth + 1, special); } else if ('m' == special) { - wattrset(wLst, COLOR_PAIR(4) | A_BOLD); + if(highlight) + wattrset(wLst, COLOR_PAIR(4) | A_REVERSE); + else + wattrset(wLst, COLOR_PAIR(4) | A_BOLD); mvwaddch(wLst, line, minwidth + 1, special); } else { - wattrset(wLst, COLOR_PAIR(3)); + if(highlight) + wattrset(wLst, COLOR_PAIR(3) | A_BOLD | A_REVERSE); + else + wattrset(wLst, COLOR_PAIR(3)); if (' ' == flag->desc[idx].stateDefault) mvwaddch(wLst, line, minwidth + 1, flag->stateDefault); else @@ -375,7 +392,8 @@ static int callback(sFlag** curr, int key) fayt[0] = '\0'; drawStatus(true); wrefresh(wInp); - } + } else + wmove(wInp, 0, strlen(fayt)); // Reset possible side scrolling of the current flags description first if(descriptionleft && (key != KEY_LEFT) && (key != KEY_RIGHT) ) { @@ -393,8 +411,8 @@ static int callback(sFlag** curr, int key) fayt[--fLen] = '\0'; drawflag(*curr, FALSE); *curr = faytsave[fLen]; - scrollcurrent(); - drawflag(*curr, TRUE); + if (!scrollcurrent()) + drawflag(*curr, TRUE); wattrset(wInp, COLOR_PAIR(5) | A_BOLD); mvwaddstr(wInp, 0, 0, fayt); whline(wInp, ' ', 2); @@ -494,6 +512,7 @@ static int callback(sFlag** curr, int key) if (eOrder_left == e_order) e_order = eOrder_right; else e_order = eOrder_left; drawFlags(); + wmove(wInp, 0, strlen(fayt)); break; #ifdef NCURSES_MOUSE_VERSION case KEY_MOUSE: @@ -520,6 +539,7 @@ static int callback(sFlag** curr, int key) wrefresh(wLst); } else { drawFlags(); + wmove(wInp, 0, strlen(fayt)); } break; #endif @@ -536,6 +556,8 @@ static int callback(sFlag** curr, int key) faytsave[fLen] = *curr; fayt[++fLen] = '\0'; + wmove(wInp, 0, fLen); + /* if the current flag already matches the input string, * then update the input area only. */ @@ -560,18 +582,20 @@ static int callback(sFlag** curr, int key) wmove(wInp, 0, fLen - 1); wrefresh(wInp); } else { - wattrset(wInp, COLOR_PAIR(5) | A_BOLD); - mvwaddstr(wInp, 0, 0, fayt); - wnoutrefresh(wInp); drawflag(*curr, FALSE); *curr = flag; if (!scrollcurrent()) drawflag(*curr, TRUE); + wattrset(wInp, COLOR_PAIR(5) | A_BOLD); + mvwaddstr(wInp, 0, 0, fayt); + wmove(wInp, 0, fLen); + wrefresh(wInp); } } } break; } + return -1; } diff --git a/ufed-curses.c b/ufed-curses.c index 6d80c8f..f8680bb 100644 --- a/ufed-curses.c +++ b/ufed-curses.c @@ -234,8 +234,8 @@ void drawFlags() { } else dispEnd = flag->listline + flag->ndesc; } - wmove(wLst, lHeight - 1, lWidth - 1); - wnoutrefresh(win(List)); + wmove(win(Input), 0, strlen(fayt)); + wnoutrefresh(wLst); } static void drawScrollbar() { @@ -268,6 +268,7 @@ static void drawScrollbar() { mvwaddch(w, sHeight - 2, 0, ACS_DARROW); mvwaddch(w, sHeight - 1, 0, ACS_VLINE); + wmove(win(Input), 0, strlen(fayt)); wnoutrefresh(w); } @@ -309,9 +310,9 @@ void drawStatus(bool withSep) waddstr(w, buf); } - // Reset cursor to 0,0 and apply changes - wmove(w, 0, 0); - wnoutrefresh(w); + // Reset cursor and apply changes + wmove(w, 0, strlen(fayt)); + wrefresh(w); } @@ -388,14 +389,13 @@ void draw(bool withSep) { drawTop(withSep); drawBottom(withSep); - drawStatus(withSep); if (flags) { drawFlags(); drawScrollbar(); } - wrefresh(win(List)); + drawStatus(withSep); } bool scrollcurrent() { @@ -555,8 +555,10 @@ int maineventloop( if(result>=0) goto exit; } - scrollcurrent(); - drawflag(currentflag, TRUE); + if (scrollcurrent()) + drawStatus(withSep); + else + drawflag(currentflag, TRUE); } } else if(wmouse_trafo(win(Scrollbar), &event.y, &event.x, FALSE)) { // Only do mouse events if there actually is a scrollbar