Skip to content

Commit 54aa1ce

Browse files
committed
Filter private methods from tab completion
1 parent ccd22ab commit 54aa1ce

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

py/repl.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,11 @@ size_t mp_repl_autocomplete(const char *str, size_t len, const mp_print_t *print
187187
if (s_len <= d_len && strncmp(s_start, d_str, s_len) == 0) {
188188
mp_load_method_protected(obj, q, dest, true);
189189
if (dest[0] != MP_OBJ_NULL) {
190+
// special case; filter out words that begin with underscore
191+
// unless there's already a partial match
192+
if (s_len == 0 && *d_str == '_') {
193+
continue;
194+
}
190195
if (match_str == NULL) {
191196
match_str = d_str;
192197
match_len = d_len;

0 commit comments

Comments
 (0)