Filter private methods from tab completion

This commit is contained in:
Kathryn Lingel 2019-05-06 12:16:29 -07:00
parent ccd22ab26a
commit 54aa1ce6de
1 changed files with 5 additions and 0 deletions

View File

@ -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) { if (s_len <= d_len && strncmp(s_start, d_str, s_len) == 0) {
mp_load_method_protected(obj, q, dest, true); mp_load_method_protected(obj, q, dest, true);
if (dest[0] != MP_OBJ_NULL) { 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 == '_') {
continue;
}
if (match_str == NULL) { if (match_str == NULL) {
match_str = d_str; match_str = d_str;
match_len = d_len; match_len = d_len;