From: msw Date: Thu, 25 Feb 1999 17:35:14 +0000 (+0000) Subject: - updated descriptions X-Git-Tag: r0-40~9 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d63d1c7041f3c5cfb69b2ca6786f8dd73a1cb67c;p=thirdparty%2Fnewt.git - updated descriptions - added support for navigating listboxes with alphabetical keypresses --- diff --git a/listbox.c b/listbox.c index 4363cfb..b043a10 100644 --- a/listbox.c +++ b/listbox.c @@ -7,6 +7,7 @@ #include #include #include +#include #include "newt.h" #include "newt_pr.h" @@ -527,7 +528,9 @@ static void listboxDraw(newtComponent co) static struct eventResult listboxEvent(newtComponent co, struct event ev) { struct eventResult er; struct listbox * li = co->data; - + struct items *item; + int i; + er.result = ER_IGNORED; if(ev.when == EV_EARLY || ev.when == EV_LATE) { @@ -603,7 +606,7 @@ static struct eventResult listboxEvent(newtComponent co, struct event ev) { li->startShowItem = li->numItems - li->curHeight; } li->currItem += li->curHeight; - if(li->currItem > li->numItems) { + if(li->currItem >= li->numItems) { li->currItem = li->numItems - 1; } newtListboxRealSetCurrent(co); @@ -626,7 +629,34 @@ static struct eventResult listboxEvent(newtComponent co, struct event ev) { er.result = ER_SWALLOWED; break; default: - /* keeps gcc quiet */ + if (isalpha(ev.u.key)) { + + for(i = 0, item = li->boxItems; item != NULL && + i < li->currItem; i++, item = item->next); + + if (item->text && (toupper(*item->text) == toupper(ev.u.key))) { + item = item->next; + i++; + } else { + item = li->boxItems; + i = 0; + } + while (item && item->text && + toupper(*item->text) != toupper(ev.u.key)) { + item = item->next; + i++; + } + if (item) { + li->currItem = i; + if(li->currItem < li->startShowItem || + li->currItem > li->startShowItem) + li->startShowItem = li->currItem; + if(li->sb) + newtScrollbarSet(li->sb, li->currItem + 1, li->numItems); + newtListboxRealSetCurrent(co); + er.result = ER_SWALLOWED; + } + } } break; diff --git a/newt.spec b/newt.spec index 1359223..fb49779 100644 --- a/newt.spec +++ b/newt.spec @@ -2,7 +2,7 @@ Summary: A development library for text mode user interfaces. Name: newt %define version 0.40 Version: %{version} -Release: 4 +Release: 5 Copyright: LGPL Group: System Environment/Libraries Source: ftp://ftp.redhat.com/pub/redhat/code/newt/newt-%{version}.tar.gz @@ -55,6 +55,10 @@ rm -rf $RPM_BUILD_ROOT %postun -p /sbin/ldconfig %changelog +* Thu Feb 25 1999 Matt Wilson +- updated descriptions +- added support for navigating listboxes with alphabetical keypresses + * Mon Feb 8 1999 Matt Wilson - made grid wrapped windows at least the size of their title bars