Commit 288ea06e authored by Tom Collins's avatar Tom Collins Committed by Damien George
Browse files

lib/utils/pyexec: Update event-driven REPL to match non-event REPL.

Don't print dupe ">>> " prompt when starting event-driven REPL.  Clear
incomplete line in transition from raw to friendly REPL.
parent e62235f8
...@@ -171,7 +171,8 @@ STATIC int pyexec_friendly_repl_process_char(int c); ...@@ -171,7 +171,8 @@ STATIC int pyexec_friendly_repl_process_char(int c);
void pyexec_event_repl_init(void) { void pyexec_event_repl_init(void) {
MP_STATE_VM(repl_line) = vstr_new(32); MP_STATE_VM(repl_line) = vstr_new(32);
repl.cont_line = false; repl.cont_line = false;
readline_init(MP_STATE_VM(repl_line), ">>> "); // no prompt before printing friendly REPL banner or entering raw REPL
readline_init(MP_STATE_VM(repl_line), "");
if (pyexec_mode_kind == PYEXEC_MODE_RAW_REPL) { if (pyexec_mode_kind == PYEXEC_MODE_RAW_REPL) {
pyexec_raw_repl_process_char(CHAR_CTRL_A); pyexec_raw_repl_process_char(CHAR_CTRL_A);
} else { } else {
...@@ -187,6 +188,7 @@ STATIC int pyexec_raw_repl_process_char(int c) { ...@@ -187,6 +188,7 @@ STATIC int pyexec_raw_repl_process_char(int c) {
} else if (c == CHAR_CTRL_B) { } else if (c == CHAR_CTRL_B) {
// change to friendly REPL // change to friendly REPL
pyexec_mode_kind = PYEXEC_MODE_FRIENDLY_REPL; pyexec_mode_kind = PYEXEC_MODE_FRIENDLY_REPL;
vstr_reset(MP_STATE_VM(repl_line));
repl.cont_line = false; repl.cont_line = false;
pyexec_friendly_repl_process_char(CHAR_CTRL_B); pyexec_friendly_repl_process_char(CHAR_CTRL_B);
return 0; return 0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment