Skip to content

Commit

Permalink
Fix for 1-letter completion
Browse files Browse the repository at this point in the history
Completion would sometimes not show if the prompt was only one letter long and identical to the previous completion
  • Loading branch information
DominikDoom committed Jan 12, 2023
1 parent d4db6a7 commit bec222f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions javascript/tagAutocomplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,8 @@ async function autocomplete(textArea, prompt, fixedTag = null) {
// Guard for empty prompt
if (prompt.length === 0) {
hideResults(textArea);
previousTags = [];
tagword = "";
return;
}

Expand All @@ -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;
Expand Down

0 comments on commit bec222f

Please sign in to comment.