diff options
Diffstat (limited to 'contactWind.c')
-rw-r--r-- | contactWind.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/contactWind.c b/contactWind.c index d353a43..f57465c 100644 --- a/contactWind.c +++ b/contactWind.c @@ -25,9 +25,22 @@ void selectNextContact(void) { contactListSelection++; } void setContactSelection(contact* c) { - int i = c - contactList; + int i = c - contactList ; + int h = h_menuContact; + if( i >= 0 && i < nbContacts ) contactListSelection = i; + + while( contactListSelection < firstConctactShow ) { + firstConctactShow-=h/2; + if( firstConctactShow < 0 ) + firstConctactShow = 0; + } + while( contactListSelection >= firstConctactShow + h ) { + firstConctactShow+=h/2; + if( firstConctactShow > nbContacts-1 ) + firstConctactShow = nbContacts-1; + } } void selectPreviousContact(void) { if( contactListSelection > 0) |