summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: dfdd6d6)
raw | patch | inline | side by side (parent: dfdd6d6)
author | Kalle Wallin <kaw@linux.se> | |
Sat, 27 Mar 2004 16:21:19 +0000 (16:21 +0000) | ||
committer | Kalle Wallin <kaw@linux.se> | |
Sat, 27 Mar 2004 16:21:19 +0000 (16:21 +0000) |
screen_utils.c | patch | blob | history | |
screen_utils.h | patch | blob | history |
diff --git a/screen_utils.c b/screen_utils.c
index 9feda742abafe63344da2807c76f24a6a2a05ccd..5788b340c77f6939e501b5d0fadfdbb98f699643 100644 (file)
--- a/screen_utils.c
+++ b/screen_utils.c
#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);
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 87cb6e04cf4c6501ba8f92835a7141af85d1dd39..30c58bfca1072d190d522d797b1a083f0fb71266 100644 (file)
--- a/screen_utils.h
+++ b/screen_utils.h
+/* 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,