fix(quick add magic): don't replace the prefix in every occurrence when it is present in the matched part

This commit is contained in:
kolaente
2023-06-05 14:09:19 +00:00
committed by konrad
parent 11979cbee0
commit 0724776ccb
2 changed files with 13 additions and 3 deletions
+5 -3
View File
@@ -109,7 +109,9 @@ const getItemsFromPrefix = (text: string, prefix: string): string[] => {
return
}
p = p.replace(prefix, '')
if (p.substring(0, 1) === prefix) {
p = p.substring(1)
}
let itemText
if (p.charAt(0) === '\'') {
@@ -120,8 +122,8 @@ const getItemsFromPrefix = (text: string, prefix: string): string[] => {
// Only until the next space
itemText = p.split(' ')[0]
}
if(itemText !== '') {
if (itemText !== '') {
items.push(itemText)
}
})