Fix for 1-letter completion

Completion would sometimes not show if the prompt was only one letter long and identical to the previous completion
This commit is contained in:
Dominik Reh
2023-01-12 15:54:57 +01:00
parent d4db6a7907
commit bec222f2b3

View File

@@ -576,6 +576,8 @@ async function autocomplete(textArea, prompt, fixedTag = null) {
// Guard for empty prompt
if (prompt.length === 0) {
hideResults(textArea);
previousTags = [];
tagword = "";
return;
}
@@ -590,6 +592,14 @@ async function autocomplete(textArea, prompt, fixedTag = null) {
.concat(weightedTags);
}
// Guard for no tags
if (!tags || tags.length === 0) {
previousTags = [];
tagword = "";
hideResults(textArea);
return;
}
let tagCountChange = tags.length - previousTags.length;
let diff = difference(tags, previousTags);
previousTags = tags;