aboutsummaryrefslogtreecommitdiffstats
path: root/screen_utils.c
diff options
context:
space:
mode:
authorKalle Wallin <kaw@linux.se>2004-03-27 16:21:19 +0000
committerKalle Wallin <kaw@linux.se>2004-03-27 16:21:19 +0000
commitd34028b356f2d4d29e5e5f40229117d6bad8e618 (patch)
tree52e66691d18f4792285e290438376ccfde6e021f /screen_utils.c
parentdfdd6d63a8503b305de36ef8733f9734da9b78f7 (diff)
downloadmpd-d34028b356f2d4d29e5e5f40229117d6bad8e618.tar.gz
mpd-d34028b356f2d4d29e5e5f40229117d6bad8e618.tar.xz
mpd-d34028b356f2d4d29e5e5f40229117d6bad8e618.zip
Added function screen_getch().
git-svn-id: https://svn.musicpd.org/ncmpc/trunk@509 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to '')
-rw-r--r--screen_utils.c29
1 files changed, 27 insertions, 2 deletions
diff --git a/screen_utils.c b/screen_utils.c
index 9feda742a..5788b340c 100644
--- a/screen_utils.c
+++ b/screen_utils.c
@@ -15,8 +15,33 @@
#define FIND_PROMPT "Find: "
#define RFIND_PROMPT "Find backward: "
+int
+screen_getch(WINDOW *w, char *prompt)
+{
+ int key = -1;
+ int prompt_len = strlen(prompt);
+
+ wclear(w);
+ wmove(w, 0, 0);
+ waddstr(w, prompt);
+ wmove(w, 0, prompt_len);
+
+ echo();
+ curs_set(1);
+ timeout(-1);
+
+ key = wgetch(w);
+
+ noecho();
+ curs_set(0);
+ timeout(SCREEN_TIMEOUT);
+
+ return key;
+}
+
+
char *
-screen_readln(WINDOW *w, char *prompt)
+screen_getstr(WINDOW *w, char *prompt)
{
char buf[256], *line = NULL;
int prompt_len = strlen(prompt);
@@ -71,7 +96,7 @@ screen_find(screen_t *screen,
case CMD_LIST_FIND_NEXT:
case CMD_LIST_RFIND_NEXT:
if( !screen->findbuf )
- screen->findbuf=screen_readln(screen->status_window.w, prompt);
+ screen->findbuf=screen_getstr(screen->status_window.w, prompt);
if( reversed )
retval = list_window_rfind(lw,
callback_fn,