diff options
-rw-r--r-- | list_window.c | 10 | ||||
-rw-r--r-- | list_window.h | 1 |
2 files changed, 11 insertions, 0 deletions
diff --git a/list_window.c b/list_window.c index ab6c7d43b..fa1f94921 100644 --- a/list_window.c +++ b/list_window.c @@ -41,6 +41,16 @@ list_window_reset(list_window_t *lw) lw->clear = 1; } +void +list_window_check_selected(list_window_t *lw, int length) +{ + if( lw->selected<0 ) + lw->selected=0; + + while( lw->selected>0 && length>0 && lw->selected>=length ) + lw->selected--; +} + void list_window_set_selected(list_window_t *lw, int n) { diff --git a/list_window.h b/list_window.h index ce799c1bd..c53f381a7 100644 --- a/list_window.h +++ b/list_window.h @@ -44,6 +44,7 @@ void list_window_first(list_window_t *lw); void list_window_last(list_window_t *lw, int length); void list_window_previous_page(list_window_t *lw); void list_window_next_page(list_window_t *lw, int length); +void list_window_check_selected(list_window_t *lw, int length); /* find a string in a list window */ int list_window_find(list_window_t *lw, |