[fix] Command preview for second argument

This commit is contained in:
Xiaro 2020-12-26 19:05:46 -05:00
parent 642fd4d7c8
commit bab641c158
No known key found for this signature in database
GPG Key ID: 996D265D6E155377
1 changed files with 6 additions and 6 deletions

View File

@ -93,24 +93,24 @@ class KamiGuiChat(
var argCount = parsedArgs.size
val inputName = parsedArgs[0]
// If the string ends with only one space (typing the next arg), adds 1 to the arg count
if (string.endsWith(' ') && !string.endsWith(" ")) {
argCount += 1
}
// Run commandAutoComplete() and return if there are only one arg
if (argCount == 1) {
commandAutoComplete(inputName)
return
}
// If the string ends with only one space (typing the next arg), adds 1 to the arg count
if (string.endsWith(' ') && !string.endsWith(" ")) {
argCount += 1
}
// Get available arg types for current arg index
val args = getArgTypeForAtIndex(parsedArgs, argCount - 1) ?: return
// Get the current input string
val inputString = parsedArgs.getOrNull(argCount - 1)
if (inputString == null) {
if (inputString.isNullOrEmpty()) {
// If we haven't input anything yet, prints list of available arg types
if (args.isNotEmpty()) cachePredict = args.toSet().joinToString("/")
return