diff --git a/jsHelper/spicetifyWrapper.js b/jsHelper/spicetifyWrapper.js
index 52fcd79be4..95cc955977 100644
--- a/jsHelper/spicetifyWrapper.js
+++ b/jsHelper/spicetifyWrapper.js
@@ -2390,7 +2390,7 @@ Spicetify.Playbar = (() => {
const prNumber = match[3];
const prLink = match[4];
let text = "
";
- if (feature) text += `${feature}: `;
+ if (feature) text += `${feature}${!feature.endsWith(":") ? ": " : " "}`;
text += `${description} (${prNumber})`;
return text;
})
diff --git a/src/apply/apply.go b/src/apply/apply.go
index fc95687c6a..af174ec13a 100644
--- a/src/apply/apply.go
+++ b/src/apply/apply.go
@@ -233,6 +233,7 @@ func insertCustomApp(jsPath string, flags Flag) {
if (len(reactSymbs) < 2) || (len(eleSymbs) == 0) {
utils.PrintError("Spotify version mismatch with Spicetify. Please report it on our github repository.")
+ utils.PrintInfo("Spicetify might have been updated for this version already. Please run `spicetify update` to check for a new version. If one isn't available yet, please wait for the update to be released.")
return content
}
diff --git a/src/cmd/config.go b/src/cmd/config.go
index 6dcc4913ff..fd920a8f4c 100644
--- a/src/cmd/config.go
+++ b/src/cmd/config.go
@@ -1,6 +1,7 @@
package cmd
import (
+ "fmt"
"log"
"os"
"strings"
@@ -121,41 +122,64 @@ func arrayType(section *ini.Section, field, value string) {
utils.Fatal(err)
}
- allExts := key.Strings("|")
+ allExts := make(map[string]bool)
+ for _, v := range key.Strings("|") {
+ allExts[v] = true
+ }
- isSubstract := value[len(value)-1] == '-'
- if isSubstract {
- value = value[0 : len(value)-1]
- found := false
- newList := []string{}
- for _, v := range allExts {
- if value == v {
- found = true
- } else {
- newList = append(newList, v)
- }
- }
+ values := strings.Split(value, "|")
+ duplicates := []string{}
+ inputValues := make(map[string]bool)
+ modifiedValues := 0
- if !found {
- unchangeWarning(field, value+" is not on the list.")
- return
+ for _, value := range values {
+ isSubstract := strings.HasSuffix(value, "-")
+ if isSubstract {
+ value = value[:len(value)-1]
}
- allExts = newList
- } else {
- for _, ext := range allExts {
- if value == ext {
- unchangeWarning(field, value+" is already in the list.")
+ if isSubstract {
+ if _, found := allExts[value]; !found {
+ unchangeWarning(field, fmt.Sprintf("%s is not on the list.", value))
return
}
+
+ modifiedValues++
+ delete(allExts, value)
+ } else {
+ if _, found := allExts[value]; found && !inputValues[value] {
+ duplicates = append(duplicates, value)
+ } else if _, found := allExts[value]; !found {
+ allExts[value] = true
+ modifiedValues++
+ }
+
+ inputValues[value] = true
}
+ }
- allExts = append(allExts, value)
+ if len(duplicates) > 0 {
+ unchangeWarning(field, fmt.Sprintf("%s %s already in the list.", strings.Join(duplicates, ", "), pluralize(len(duplicates), "is", "are")))
}
- newList := strings.Join(allExts, "|")
- key.SetValue(newList)
- changeSuccess(field, newList)
+ if modifiedValues == 0 {
+ return
+ }
+
+ newList := make([]string, 0, len(allExts))
+ for k := range allExts {
+ newList = append(newList, k)
+ }
+
+ key.SetValue(strings.Join(newList, "|"))
+ changeSuccess(field, strings.Join(newList, "|"))
+}
+
+func pluralize(count int, singular, plural string) string {
+ if count == 1 {
+ return singular
+ }
+ return plural
}
func stringType(section *ini.Section, field, value string) {