mirror of
https://github.com/SuspiciousActivity/ByteEdit.git
synced 2026-08-13 17:56:17 +00:00
Fixed a bug with autocomplete
This commit is contained in:
1 parent
64c153f5e9
commit
5b5b2ad144
1 file changed
+11
@@ -99,6 +99,17 @@ public abstract class CompletionProviderBase implements CompletionProvider {
|
|||||||
if (/* sortByRelevance */true) {
|
if (/* sortByRelevance */true) {
|
||||||
Collections.sort(completions, sortByRelevanceComparator);
|
Collections.sort(completions, sortByRelevanceComparator);
|
||||||
}
|
}
|
||||||
|
// ensure that an exact match always stays at the first position
|
||||||
|
int indexOfMatch = -1;
|
||||||
|
for (int i = 0; i < completions.size(); i++) {
|
||||||
|
if (completions.get(i).getInputText().startsWith(comp.getText())) {
|
||||||
|
indexOfMatch = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (indexOfMatch != -1) {
|
||||||
|
completions.add(0, completions.remove(indexOfMatch));
|
||||||
|
}
|
||||||
return completions;
|
return completions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user