diff --git a/src/screen_text.c b/src/screen_text.c
index faee9cb76aee4c20461d7db3c31ddc5592f0ed1f..617d38e2b592d0cf27653f09f651d667fd4f8564 100644 (file)
--- a/src/screen_text.c
+++ b/src/screen_text.c
/* ncmpc (Ncurses MPD Client)
- * (c) 2004-2009 The Music Player Daemon Project
+ * (c) 2004-2010 The Music Player Daemon Project
* Project homepage: http://musicpd.org
* This program is free software; you can redistribute it and/or modify
g_free(g_ptr_array_index(text->lines, i));
g_ptr_array_set_size(text->lines, 0);
+ list_window_set_length(text->lw, 0);
}
void
if (*p != 0)
g_ptr_array_add(text->lines, g_strdup(p));
+
+ list_window_set_length(text->lw, text->lines->len);
}
const char *
-screen_text_list_callback(unsigned idx, G_GNUC_UNUSED bool *highlight,
- G_GNUC_UNUSED char** sc, void *data)
+screen_text_list_callback(unsigned idx, void *data)
{
const struct screen_text *text = data;
static char buffer[256];
char *value;
- if (idx >= text->lines->len)
- return NULL;
+ assert(idx < text->lines->len);
value = utf8_to_locale(g_ptr_array_index(text->lines, idx));
g_strlcpy(buffer, value, sizeof(buffer));
screen_text_cmd(struct screen_text *text,
G_GNUC_UNUSED struct mpdclient *c, command_t cmd)
{
- if (list_window_scroll_cmd(text->lw, text->lines->len, cmd)) {
+ if (list_window_scroll_cmd(text->lw, cmd)) {
screen_text_repaint(text);
return true;
}
- text->lw->selected = text->lw->start + text->lw->rows;
- if (screen_find(text->lw, text->lines->len,
- cmd, screen_text_list_callback, text)) {
+ list_window_set_cursor(text->lw, text->lw->start);
+ if (screen_find(text->lw, cmd, screen_text_list_callback, text)) {
/* center the row */
- list_window_center(text->lw, text->lines->len,
- text->lw->selected);
+ list_window_center(text->lw, text->lw->selected);
screen_text_repaint(text);
return true;
}