Skip to content

Commit 288ea06

Browse files
tomlogicdpgeorge
authored andcommitted
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.
1 parent e62235f commit 288ea06

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

lib/utils/pyexec.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,8 @@ STATIC int pyexec_friendly_repl_process_char(int c);
171171
void pyexec_event_repl_init(void) {
172172
MP_STATE_VM(repl_line) = vstr_new(32);
173173
repl.cont_line = false;
174-
readline_init(MP_STATE_VM(repl_line), ">>> ");
174+
// no prompt before printing friendly REPL banner or entering raw REPL
175+
readline_init(MP_STATE_VM(repl_line), "");
175176
if (pyexec_mode_kind == PYEXEC_MODE_RAW_REPL) {
176177
pyexec_raw_repl_process_char(CHAR_CTRL_A);
177178
} else {
@@ -187,6 +188,7 @@ STATIC int pyexec_raw_repl_process_char(int c) {
187188
} else if (c == CHAR_CTRL_B) {
188189
// change to friendly REPL
189190
pyexec_mode_kind = PYEXEC_MODE_FRIENDLY_REPL;
191+
vstr_reset(MP_STATE_VM(repl_line));
190192
repl.cont_line = false;
191193
pyexec_friendly_repl_process_char(CHAR_CTRL_B);
192194
return 0;

0 commit comments

Comments
 (0)