diff --git a/src/snek/static/chat-input.js b/src/snek/static/chat-input.js index e32ffeb..9239d22 100644 --- a/src/snek/static/chat-input.js +++ b/src/snek/static/chat-input.js @@ -75,15 +75,19 @@ class ChatInputComponent extends HTMLElement { authors.forEach(author => { const lowerAuthor = author.toLowerCase(); let distance = this.levenshteinDistance(lowerMention, lowerAuthor); + + if(!this.isSubsequence(lowerMention,lowerAuthor)) { distance += 10 } + + console.info([ mention, author, distance ]); if (distance < minDistance) { minDistance = distance; closestAuthor = author; } - console.info({ mention, closestAuthor, distance }); + }); return { mention, closestAuthor, distance: minDistance };