summaryrefslogtreecommitdiff
path: root/shared/runtime/pyexec.c
diff options
context:
space:
mode:
authorDamien George <damien@micropython.org>2021-07-27 00:43:35 +1000
committerDamien George <damien@micropython.org>2022-03-10 10:58:33 +1100
commitac2293161e98e73d39434628f995e85bd97e52c2 (patch)
tree6cc14ad736b124e085371ec47e734b90f7e98ddd /shared/runtime/pyexec.c
parentcac939ddc3625da7e6cf1cf0309daba25fc1cedb (diff)
py/modsys: Add optional mutable attributes sys.ps1/ps2 and use them.
This allows customising the REPL prompt strings. Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'shared/runtime/pyexec.c')
-rw-r--r--shared/runtime/pyexec.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/shared/runtime/pyexec.c b/shared/runtime/pyexec.c
index ae6dd770b..9fde987a4 100644
--- a/shared/runtime/pyexec.c
+++ b/shared/runtime/pyexec.c
@@ -433,7 +433,7 @@ STATIC int pyexec_friendly_repl_process_char(int c) {
vstr_add_byte(MP_STATE_VM(repl_line), '\n');
repl.cont_line = true;
- readline_note_newline("... ");
+ readline_note_newline(mp_repl_get_ps2());
return 0;
} else {
@@ -454,7 +454,7 @@ STATIC int pyexec_friendly_repl_process_char(int c) {
if (mp_repl_continue_with_input(vstr_null_terminated_str(MP_STATE_VM(repl_line)))) {
vstr_add_byte(MP_STATE_VM(repl_line), '\n');
- readline_note_newline("... ");
+ readline_note_newline(mp_repl_get_ps2());
return 0;
}
@@ -468,7 +468,7 @@ STATIC int pyexec_friendly_repl_process_char(int c) {
vstr_reset(MP_STATE_VM(repl_line));
repl.cont_line = false;
repl.paste_mode = false;
- readline_init(MP_STATE_VM(repl_line), ">>> ");
+ readline_init(MP_STATE_VM(repl_line), mp_repl_get_ps1());
return 0;
}
}
@@ -598,7 +598,7 @@ friendly_repl_reset:
}
vstr_reset(&line);
- int ret = readline(&line, ">>> ");
+ int ret = readline(&line, mp_repl_get_ps1());
mp_parse_input_kind_t parse_input_kind = MP_PARSE_SINGLE_INPUT;
if (ret == CHAR_CTRL_A) {
@@ -651,7 +651,7 @@ friendly_repl_reset:
// got a line with non-zero length, see if it needs continuing
while (mp_repl_continue_with_input(vstr_null_terminated_str(&line))) {
vstr_add_byte(&line, '\n');
- ret = readline(&line, "... ");
+ ret = readline(&line, mp_repl_get_ps2());
if (ret == CHAR_CTRL_C) {
// cancel everything
mp_hal_stdout_tx_str("\r\n");