aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--screen_utils.c29
-rw-r--r--screen_utils.h5
2 files changed, 31 insertions, 3 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,
diff --git a/screen_utils.h b/screen_utils.h
index 87cb6e04c..30c58bfca 100644
--- a/screen_utils.h
+++ b/screen_utils.h
@@ -1,6 +1,9 @@
+/* read a characher from the status window */
+int screen_getch(WINDOW *w, char *prompt);
+
/* read a string from the status window */
-char *screen_readln(WINDOW *w, char *prompt);
+char *screen_getstr(WINDOW *w, char *prompt);
/* query user for a string and find it in a list window */
int screen_find(screen_t *screen,