From 29b21813ed8f6a8d166286e71bdd7d2e30af74bf Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Sun, 8 Apr 2018 06:11:54 -0700 Subject: listener: completion: wrong use of package fallback. The problem is that completion on pub:sym[Tab] is completing on the fallback list, because pub is the current package. If we type pub:l[Tab], we might complete to pub:list. But that's because usr:list was found in the fallbacklist; pub:list isn't that symbol, and its use will shadow usr:list. This is against the documentatiion too, which describes it the way it should work: simply that the fallback list of the current package is used under completion when no package qualifier prefix is present. * parser.c (get_visible_syms): Rename second parameter to reflect its actual meaning, rather than an original intended use. (find_matching_syms): Only allow get_visible_syms to traverse package fallback lists if qualify is false. Thus even if we are completing against the current package, if that package is being explicitly indicated with a prefix, then only the package local symbols are included. --- parser.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'parser.c') diff --git a/parser.c b/parser.c index 82576f43..237860c8 100644 --- a/parser.c +++ b/parser.c @@ -710,11 +710,11 @@ static void load_rcfile(val name) uw_catch_end; } -static val get_visible_syms(val package, int is_cur) +static val get_visible_syms(val package, int include_fallback) { val fblist; - if (!is_cur || nilp((fblist = package_fallback_list(package)))) { + if (!include_fallback || nilp((fblist = package_fallback_list(package)))) { return package_symbols(package); } else { val symhash = copy_hash(package->pk.symhash); @@ -748,7 +748,7 @@ static void find_matching_syms(lino_completions_t *cpl, package_name(package))); val syms = ((kind == 'S' || kind == 'M') ? hash_keys((get_slot_syms(package, is_cur, tnil(kind == 'M')))) - : get_visible_syms(package, is_cur != nil)); + : get_visible_syms(package, is_cur != nil && !qualify)); for ( ; syms; syms = cdr(syms)) { val sym = car(syms); -- cgit v1.2.3