summaryrefslogtreecommitdiff
path: root/py/repl.c
diff options
context:
space:
mode:
authorBenjamin Shockley <benjaminshockley@hotmail.com>2020-08-20 13:48:15 -0500
committerGitHub <noreply@github.com>2020-08-20 13:48:15 -0500
commit0084f0af24e4e219bc040c52ee723959423de6e2 (patch)
tree1aebdb362f08bf6417caa87836e3e4e739afc964 /py/repl.c
parent9aebe2f1efc99871fcf283c304e3a8700050d736 (diff)
parent4d7b9cde33934a44c4c905a49d2f831339fc8bd2 (diff)
Merge pull request #2 from adafruit/master
Master
Diffstat (limited to 'py/repl.c')
-rw-r--r--py/repl.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/py/repl.c b/py/repl.c
index da0fefb3a..aa91c3f12 100644
--- a/py/repl.c
+++ b/py/repl.c
@@ -187,6 +187,11 @@ size_t mp_repl_autocomplete(const char *str, size_t len, const mp_print_t *print
if (s_len <= d_len && strncmp(s_start, d_str, s_len) == 0) {
mp_load_method_protected(obj, q, dest, true);
if (dest[0] != MP_OBJ_NULL) {
+ // special case; filter out words that begin with underscore
+ // unless there's already a partial match
+ if (s_len == 0 && d_str[0] == '_') {
+ continue;
+ }
if (match_str == NULL) {
match_str = d_str;
match_len = d_len;
@@ -210,6 +215,10 @@ size_t mp_repl_autocomplete(const char *str, size_t len, const mp_print_t *print
// nothing found
if (q_first == 0) {
+ if (s_len == 0) {
+ *compl_str = " ";
+ return 4;
+ }
// If there're no better alternatives, and if it's first word
// in the line, try to complete "import".
if (s_start == org_str) {