diff options
author | Kalle Wallin <kaw@linux.se> | 2004-03-22 18:10:23 +0000 |
---|---|---|
committer | Kalle Wallin <kaw@linux.se> | 2004-03-22 18:10:23 +0000 |
commit | 070f67aef44e135b2fbe14a35ca8b3f9bb8a1cc7 (patch) | |
tree | 8759a47ea4639621726e44667d28bd7ba797a7ae /screen_utils.c | |
parent | 3da656b83260ef257675a4ae4c681b3b99f83353 (diff) | |
download | mpd-070f67aef44e135b2fbe14a35ca8b3f9bb8a1cc7.tar.gz mpd-070f67aef44e135b2fbe14a35ca8b3f9bb8a1cc7.tar.xz mpd-070f67aef44e135b2fbe14a35ca8b3f9bb8a1cc7.zip |
Added find (in page) functionality.
git-svn-id: https://svn.musicpd.org/ncmpc/trunk@369 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to '')
-rw-r--r-- | screen_utils.c | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/screen_utils.c b/screen_utils.c index e100cbf52..1647fffbb 100644 --- a/screen_utils.c +++ b/screen_utils.c @@ -13,6 +13,9 @@ #include "command.h" #include "screen.h" +#if 0 +#include <readline/readline.h> +#endif list_window_t * @@ -150,3 +153,51 @@ list_window_previous_page(list_window_t *lw) else list_window_first(lw); } + +int +list_window_find(list_window_t *lw, + list_window_callback_fn_t callback, + void *callback_data, + char *str) +{ + int i = lw->selected+1; + + while( i< lw->rows ) + { + int h; + char *label = (callback) (i,&h,callback_data); + + if( str && label && strstr(label, str) ) + { + lw->selected = i; + return 0; + } + i++; + } + return 1; +} + + +char * +screen_readln(WINDOW *w, char *prompt) +{ + char buf[256], *line = NULL; + int prompt_len = strlen(prompt); + + wclear(w); + wmove(w, 0, 0); + waddstr(w, prompt); + wmove(w, 0, prompt_len); + + echo(); + curs_set(1); + + if( wgetnstr(w, buf, 256) == OK ) + line = strdup(buf); + + noecho(); + curs_set(0); + + return line; +} + |