aboutsummaryrefslogtreecommitdiff
path: root/py/repl.c
diff options
context:
space:
mode:
authorDamien George <damien@micropython.org>2022-04-14 11:33:00 +1000
committerDamien George <damien@micropython.org>2022-04-22 17:00:16 +1000
commita8f23f6366b7bb258c7c34a45a3a9bde99e4a32b (patch)
treed9df937f3df2b6021bddcdbd12899b0cda44fdeb /py/repl.c
parentcaaff940a265bd30cca5a271b49e7addaf05ef53 (diff)
shared/readline: Make tab insert an indent when it follows whitespace.
Entering tab at the REPL will now make it insert an indent (4 spaces) in the following cases: - after any whitespace on a line - at the start of a line that is not the first line This changes the existing behaviour where a tab would insert an indent only if there were no matches in the auto-complete search, and it was the start of the line. This means, if there were any symbols in the global namespace, tab could never be used to indent. Note that entering tab at the start of the first line will still do auto-completion, but will now do nothing if there are no symbols in the global namespace, which is more consistent than before. Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'py/repl.c')
-rw-r--r--py/repl.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/py/repl.c b/py/repl.c
index 4e47cf784..0369b0219 100644
--- a/py/repl.c
+++ b/py/repl.c
@@ -313,10 +313,7 @@ size_t mp_repl_autocomplete(const char *str, size_t len, const mp_print_t *print
return sizeof(import_str) - 1 - s_len;
}
}
- if (q_first == 0) {
- *compl_str = " ";
- return s_len ? 0 : 4;
- }
+ return 0;
}
// 1 match found, or multiple matches with a common prefix