mirror of
https://github.com/chylex/IntelliJ-IdeaVim.git
synced 2025-04-07 11:15:47 +02:00
Fix an issue that the XML config can't store nulls
This commit is contained in:
parent
098243fb12
commit
fc93661c62
@ -30,7 +30,7 @@ internal class VimState {
|
||||
}
|
||||
stringMap.keys.forEach { name ->
|
||||
notifications?.getChild(name)?.getAttributeValue("value")?.let {
|
||||
stringMap[name] = it
|
||||
stringMap[name] = it.decode
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -46,12 +46,18 @@ internal class VimState {
|
||||
}
|
||||
stringMap.forEach { (name, value) ->
|
||||
val child = Element(name)
|
||||
child.setAttribute("value", value)
|
||||
child.setAttribute("value", value.encode)
|
||||
notifications.addContent(child)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private val String?.encode: String get() = this ?: NULL_VALUE
|
||||
private val String?.decode: String? get() = if (this == NULL_VALUE) null else this
|
||||
|
||||
// Settings cannot store null values
|
||||
private const val NULL_VALUE = "__NULL_VALUE_CONST__"
|
||||
|
||||
private val map by lazy { mutableMapOf<String, Boolean>() }
|
||||
private val stringMap by lazy { mutableMapOf<String, String?>() }
|
||||
|
||||
@ -68,7 +74,8 @@ private class StateProperty(val xmlName: String) : ReadWriteProperty<VimState, B
|
||||
}
|
||||
}
|
||||
|
||||
private class StringProperty(val propertyName: String, val defaultValue: String?) : ReadWriteProperty<VimState, String?> {
|
||||
private class StringProperty(val propertyName: String, val defaultValue: String?) :
|
||||
ReadWriteProperty<VimState, String?> {
|
||||
|
||||
init {
|
||||
stringMap[propertyName] = defaultValue
|
||||
|
Loading…
Reference in New Issue
Block a user