Add readline history support.
This commit is contained in:
parent
83c437cb0d
commit
903b24f041
@ -16,6 +16,7 @@
|
|||||||
#include "repl.h"
|
#include "repl.h"
|
||||||
|
|
||||||
#include <readline/readline.h>
|
#include <readline/readline.h>
|
||||||
|
#include <readline/history.h>
|
||||||
|
|
||||||
static char *str_join(const char *s1, int sep_char, const char *s2) {
|
static char *str_join(const char *s1, int sep_char, const char *s2) {
|
||||||
int l1 = strlen(s1);
|
int l1 = strlen(s1);
|
||||||
@ -38,6 +39,7 @@ static void do_repl(void) {
|
|||||||
// EOF
|
// EOF
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
add_history(line);
|
||||||
if (mp_repl_is_compound_stmt(line)) {
|
if (mp_repl_is_compound_stmt(line)) {
|
||||||
for (;;) {
|
for (;;) {
|
||||||
char *line2 = readline("... ");
|
char *line2 = readline("... ");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user