You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is basically what has been raised as concern in #86 (comment)
The current SuggestionsBuilder code does not correctly handle cases where after lowercasing the string, the length respectively the character indices change.
For language-insensitive conversion (Locale.ROOT) this can currently only occur for İ (U+0130; "Latin Capital Letter I with Dot Above"), see also Unicode Special Casing (but it could affect more code points in the future).
The effect of this is that command nodes and argument types which use SuggestionsBuilder.getRemainingLowerCase() fail to provide command suggestions.
Affected built-in command nodes / argument types:
LiteralCommandNode
BoolArgumentType
Possible solutions
Manually trying to map between the source and the lowercased string is probably rather difficult, if not impossible.
Instead an alternative might be to use one of the Character methods for lowercasing (toLowerCase(char) or toLowerCase(int)), which maintain a 1:1 relationship. However, that would require manually going through all characters / code points and converting them which is very likely less performant than the String.toLowerCase methods.
❌ When the first argument contains İ (\u0130) CommandDispatcher does not provide any suggestions
The text was updated successfully, but these errors were encountered:
Marcono1234
changed the title
SuggestionsBuilder.getRemainingLowerCase() does not work correctly when string length changesSuggestionsBuilder.getRemainingLowerCase() does not work correctly for Unicode special casing rules
May 4, 2021
Version
1.0.18
Description
This is basically what has been raised as concern in #86 (comment)
The current
SuggestionsBuilder
code does not correctly handle cases where after lowercasing the string, the length respectively the character indices change.For language-insensitive conversion (
Locale.ROOT
) this can currently only occur forİ
(U+0130
; "Latin Capital Letter I with Dot Above"), see also Unicode Special Casing (but it could affect more code points in the future).The effect of this is that command nodes and argument types which use
SuggestionsBuilder.getRemainingLowerCase()
fail to provide command suggestions.Affected built-in command nodes / argument types:
LiteralCommandNode
BoolArgumentType
Possible solutions
Manually trying to map between the source and the lowercased string is probably rather difficult, if not impossible.
Instead an alternative might be to use one of the
Character
methods for lowercasing (toLowerCase(char)
ortoLowerCase(int)
), which maintain a 1:1 relationship. However, that would require manually going through all characters / code points and converting them which is very likely less performant than theString.toLowerCase
methods.Example (Minecraft)
Version: 21w17a
Type in chat:
❌ Notice how no suggestions are shown
Example (code)
❌ When the first argument contains
İ
(\u0130
)CommandDispatcher
does not provide any suggestionsThe text was updated successfully, but these errors were encountered: