Skip to content

Commit

Permalink
CompletionMatcherImpl: if completing word contains '=' start camel ma…
Browse files Browse the repository at this point in the history
…tching after it
  • Loading branch information
mattirn committed Jan 10, 2021
1 parent 6766709 commit 2c53681
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2002-2020, the original author or authors.
* Copyright (c) 2002-2021, the original author or authors.
*
* This software is distributable under the BSD license. See the terms of the
* BSD license in the documentation provided with this software.
Expand Down Expand Up @@ -42,7 +42,7 @@ public void compile(Map<LineReader.Option, Boolean> options, boolean prefix, Com
reset(caseInsensitive);
defaultMatchers(options, prefix, line, caseInsensitive, errors, originalGroupName);
if (LineReader.Option.COMPLETE_MATCHER_CAMELCASE.isSet(options)) {
matchers.add(simpleMatcher(candidate -> camelMatch(line.word(), 0, candidate, 0)));
matchers.add(simpleMatcher(candidate -> camelMatch(line.word(), line.word().indexOf('=') + 1, candidate, 0)));
}
}

Expand Down Expand Up @@ -154,11 +154,10 @@ Map<String, List<Candidate>>> typoMatcher(String word, int errors, boolean caseI
protected boolean camelMatch(String word, int i, String candidate, int j) {
if (word.length() <= i) {
return true;
} else if (candidate.length() <= j) {
return false;
} else {
char c = word.charAt(i);
if (candidate.length() <= j) {
return false;
}
if (c == candidate.charAt(j)) {
if (camelMatch(word, i + 1, candidate, j + 1)) {
return true;
Expand Down

0 comments on commit 2c53681

Please sign in to comment.