diff options
author | ache <ache@ache.one> | 2019-02-10 23:51:30 +0100 |
---|---|---|
committer | ache <ache@ache.one> | 2019-02-10 23:51:30 +0100 |
commit | 040676f315af3564df897a8c9fae7eeec2c4b085 (patch) | |
tree | b76821bac67f6ffc867a4c2ca5dfcea7b1c563cf | |
parent | Manage new message (diff) |
Fix search focus
-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) |