From af4f0ca1d9b5ceccc4dcf31caa0fb25d434c6852 Mon Sep 17 00:00:00 2001 From: Kalle Wallin Date: Sat, 19 Jun 2004 19:32:19 +0000 Subject: [PATCH] fixed the display of completion lists git-svn-id: https://svn.musicpd.org/ncmpc/trunk@1565 09075e82-0dd4-0310-85a5-a0d7c8717e4f --- src/screen_utils.c | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/src/screen_utils.c b/src/screen_utils.c index 16359c6..d6e19fa 100644 --- a/src/screen_utils.c +++ b/src/screen_utils.c @@ -162,20 +162,38 @@ screen_find(screen_t *screen, void screen_display_completion_list(screen_t *screen, GList *list) { + static GList *prev_list = NULL; + static gint prev_length = 0; + static gint offset = 0; WINDOW *w = screen->main_window.w; - gint y=0; + gint length, y=0; + + length = g_list_length(list); + if( list==prev_list && length==prev_length ) + { + offset += screen->main_window.rows; + if( offset>=length ) + offset=0; + } + else + { + prev_list = list; + prev_length = length; + offset = 0; + } colors_use(w, COLOR_STATUS_ALERT); while( ymain_window.rows ) { + GList *item = g_list_nth(list, y+offset); + wmove(w, y++, 0); wclrtoeol(w); - if( list ) + if( item ) { - gchar *tmp = g_strdup(list->data); + gchar *tmp = g_strdup(item->data); waddstr(w, basename(tmp)); g_free(tmp); - list = list->next; } } wrefresh(w); -- 2.30.2