node text input: don't remove . for internal commands

This commit is contained in:
Moritz Zwerger 2023-11-09 16:11:00 +01:00
parent 097e7b9174
commit 2868da6070
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4

View File

@ -121,11 +121,13 @@ class NodeTextInputElement(
} }
fun updateSuggestion(suggestion: Suggestion) { fun updateSuggestion(suggestion: Suggestion) {
val slash = value.startsWith("/") val prefix = when { // TODO: really dirty dirty hack to not remove the / or . before the command. ChatNode should be responsible for that
var value = SuggestionUtil.apply(value.removePrefix("/"), suggestion) value.startsWith("/") -> "/"
if (slash) { value.startsWith(".") -> "."
value = "/$value" // TODO: dirty hack else -> ""
} }
var value = SuggestionUtil.apply(value.removePrefix(prefix), suggestion)
value = prefix + value
_set(value) _set(value)
forceApply() forceApply()
} }