Don't make a local variable when adding a Macro in ConfigScreen.kt
This commit is contained in:
parent
c43b584096
commit
dd2c01b461
|
@ -88,10 +88,8 @@ val SnowyConfigScreen: Screen = object: Screen(translationComponent) {
|
|||
)
|
||||
}
|
||||
}.setTooltip(TranslatableComponent("$confPrefix.general.macros.tooltip")).setSaveConsumer { it.forEach { string ->
|
||||
val splitString: Pair<String, String>? = string.split(":").map { toTrim -> toTrim.trimStart() }.let { element ->
|
||||
if (element.size == 2) element.component1() to element.component2() else null
|
||||
}; if (splitString != null) {
|
||||
Macro(title = splitString.first, command = splitString.second).let { newMacro ->
|
||||
with(string.split(":")) {
|
||||
if (size == 2) Macro(title = component1().trimStart(), command = component2().trim()).let { newMacro ->
|
||||
macrosButtons.removeIf { existingMacro ->
|
||||
(existingMacro.title == newMacro.title)
|
||||
|| (existingMacro.command == newMacro.command)
|
||||
|
|
Loading…
Reference in New Issue