aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKalle Wallin <kaw@linux.se>2004-06-19 19:32:19 +0000
committerKalle Wallin <kaw@linux.se>2004-06-19 19:32:19 +0000
commitaf4f0ca1d9b5ceccc4dcf31caa0fb25d434c6852 (patch)
tree5f78a16f6027fd4ec199773579032db939db28fa /src
parent60ba82303f21ccf5ee53e6e2a48ca3d4dee89acb (diff)
downloadmpd-af4f0ca1d9b5ceccc4dcf31caa0fb25d434c6852.tar.gz
mpd-af4f0ca1d9b5ceccc4dcf31caa0fb25d434c6852.tar.xz
mpd-af4f0ca1d9b5ceccc4dcf31caa0fb25d434c6852.zip
fixed the display of completion lists
git-svn-id: https://svn.musicpd.org/ncmpc/trunk@1565 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to 'src')
-rw-r--r--src/screen_utils.c26
1 files changed, 22 insertions, 4 deletions
diff --git a/src/screen_utils.c b/src/screen_utils.c
index 16359c6ea..d6e19fa3e 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( y<screen->main_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);