aboutsummaryrefslogtreecommitdiff
path: root/readline.c
diff options
context:
space:
mode:
Diffstat (limited to 'readline.c')
-rw-r--r--readline.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/readline.c b/readline.c
index bc37677..cb82047 100644
--- a/readline.c
+++ b/readline.c
@@ -103,6 +103,7 @@ static void msg_win_redisplay(bool for_resize)
}
static void got_command(char *line)
{
+ fprintf(stderr, "got_command\n");
if( line )
if (*line != '\0')
add_history(line);
@@ -172,9 +173,19 @@ void init_readline(void)
}
-void readline_n(void) {
+void readline_n(const char* info, const char* str) {
curs_set(2);
resize();
+
+ if( info ) {
+ rl_callback_handler_install(info, got_command);
+ }
+
+ for( ; *str ; str++ ) {
+ if( *str != '\n' && *str != '\f' && *str != KEY_RESIZE ) {
+ forward_to_readline(*str);
+ }
+ }
while (!should_exit) {
// Using getch() here instead would refresh stdscr, overwriting the
// initial contents of the other windows on startup
@@ -183,13 +194,13 @@ void readline_n(void) {
if( c == '\n')
should_exit = 1;
if (c == KEY_RESIZE)
- ;//resize();
+ resize();
else if (c == '\f') { // Ctrl-L -- redraw screen.
// Makes the next refresh repaint the screen from scratch
CHECK(clearok, curscr, TRUE);
// Resize and reposition windows in case that got messed up
// somehow
- //resize();
+ resize();
}
else
forward_to_readline(c);
@@ -197,5 +208,3 @@ void readline_n(void) {
should_exit = 0;
}
-
-