make fuzzy wildcards non-greedy

This commit is contained in:
LenAnderson 2024-03-26 20:13:41 -04:00
parent 7078fc76ba
commit d9c5d0b616
1 changed files with 1 additions and 1 deletions

View File

@ -1982,7 +1982,7 @@ export function setNewSlashCommandAutoComplete(textarea, isFloating = false) {
isReplacable = isInput && (!executor ? true : textarea.selectionStart == executor.start - 2 + executor.name.length + 1);
const matchType = power_user.stscript?.matching ?? 'strict';
const fuzzyRegex = new RegExp(`^(.*)${slashCommand.split('').map(char=>`(${escapeRegex(char)})`).join('(.*)')}(.*)$`, 'i');
const fuzzyRegex = new RegExp(`^(.*?)${slashCommand.split('').map(char=>`(${escapeRegex(char)})`).join('(.*?)')}(.*?)$`, 'i');
const matchers = {
'strict': (cmd) => cmd.toLowerCase().startsWith(slashCommand),
'includes': (cmd) => cmd.toLowerCase().includes(slashCommand),