SCEE
SCEE copied to clipboard
Ignore leading and trailing whitespace in raw tag editor
as they are hard to visually spot, and we trim() them later anyway.
It will still detect whitespace in the middle of the key as a problem (as it should)
Fixes https://github.com/Helium314/SCEE/issues/822
debug .apk at https://github.com/mnalis/StreetComplete/actions/runs/16155435454, if people would like to test if it works correctly. @matkoniecz could you confirm it fixes the issue?
Specifically, in Raw tag editor it:
- should allow entering leading and trailing whitespace in key,
- ... but it should remove those whitespaces before upload
- however whitespace in the middle of the key should not be allowed (i.e. checkmark button should not apper)
- all other invalid chars like
#,=, etc should continue to not be allowed anywhere (begging, middle, or the end)
I think it's a bit more readable to trim the keys before checking against the regex, i.e. problematicKeyCharacters.containsMatchIn(it.trim()) instead of problematicKeyCharacters.containsMatchIn(it).
Do you agree, or do you prefer your changed regex?
Do you agree, or do you prefer your changed regex?
I'm not particularly attached to the regex, so feel free to use whatever works better !
(I only used regex because it did not require deeper understanding of codebase nor of Kotlin... When all you have is a hammer, everything tends to look like a nail :smiley: )
Alright! I'll try both variants once I find some time, or latest when doing the next upstream merge (may take some time).
Works, so I adjusted the PR. As usual lately, merge will have to wait.