Skip to content

Commit

Permalink
completion: don't override CharFilter decision by heuristics based on…
Browse files Browse the repository at this point in the history
… selected item (that would allow a better fix for KT-9813)
  • Loading branch information
donnerpeter committed Oct 31, 2015
1 parent 94242dc commit 9982504
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -184,23 +184,11 @@ private static boolean completeTillTypedCharOccurrence(char charTyped, LookupImp

static CharFilter.Result getLookupAction(final char charTyped, final LookupImpl lookup) {
final CharFilter.Result filtersDecision = getFiltersDecision(charTyped, lookup);

final LookupElement currentItem = lookup.getCurrentItem();
if (currentItem != null && charTyped != ' ') {
String postfix = lookup.getAdditionalPrefix() + charTyped;
final PrefixMatcher matcher = lookup.itemMatcher(currentItem);
for (String lookupString : currentItem.getAllLookupStrings()) {
if (lookupString.startsWith(matcher.getPrefix() + postfix)) {
return CharFilter.Result.ADD_TO_PREFIX;
}
}
}

if (filtersDecision != null) {
return filtersDecision;
}
throw new AssertionError("Typed char not handler by char filter: c=" + charTyped +
"; prefix=" + currentItem +
"; prefix=" + lookup.getCurrentItem() +
"; filters=" + Arrays.toString(getFilters()));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ public Result acceptChar(char c, final int prefixLength, final Lookup lookup) {
switch(c){
case '-':
case ':':
case '?':
return Result.ADD_TO_PREFIX;
case '/':
if (isWithinTag(lookup)) {
Expand Down

0 comments on commit 9982504

Please sign in to comment.