summaryrefslogtreecommitdiff
path: root/unix/main.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2015-05-24 22:36:31 +0100
committerDamien George <damien.p.george@gmail.com>2015-05-27 15:59:43 +0100
commit9ae3fc65235303322ef5282d3cdd4ca99a2c37cc (patch)
tree5644437cc732a8a33f2ec8752610d4d55c8a740b /unix/main.c
parent4a10214be20cb8a51724913903678f4506358752 (diff)
unix: Add option to use uPy readline, and enable by default.
This gets uPy readline working with unix port, with tab completion and history. GNU readline is still supported, configure using MICROPY_USE_READLINE variable.
Diffstat (limited to 'unix/main.c')
-rw-r--r--unix/main.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/unix/main.c b/unix/main.c
index fb6868c88..1cc174c26 100644
--- a/unix/main.c
+++ b/unix/main.c
@@ -278,8 +278,6 @@ STATIC void set_sys_argv(char *argv[], int argc, int start_arg) {
#endif
int main(int argc, char **argv) {
- prompt_read_history();
-
mp_stack_set_limit(40000 * (BYTES_PER_WORD / 4));
pre_process_options(argc, argv);
@@ -445,7 +443,9 @@ int main(int argc, char **argv) {
}
if (ret == NOTHING_EXECUTED) {
+ prompt_read_history();
ret = do_repl();
+ prompt_write_history();
}
#if MICROPY_PY_MICROPYTHON_MEM_INFO
@@ -463,7 +463,6 @@ int main(int argc, char **argv) {
#endif
//printf("total bytes = %d\n", m_get_total_bytes_allocated());
- prompt_write_history();
return ret & 0xff;
}