WebHost/Options Creator: Make player name caps aware of replaced tags - #6377
Open
duckboycool wants to merge 4 commits into
Open
WebHost/Options Creator: Make player name caps aware of replaced tags#6377duckboycool wants to merge 4 commits into
duckboycool wants to merge 4 commits into
Conversation
duckboycool
commented
Aug 5, 2026
| evt.preventDefault(); | ||
| window.scrollTo(0, 0); | ||
| showUserMessage('You must enter a player name!'); | ||
| } |
Collaborator
Author
There was a problem hiding this comment.
This could refuse to submit with a name too long, but I think it's probably good enough for the user to still see the warning.
| #player-options #name-warning { | ||
| font-weight: bold; | ||
| color: #ffd642; | ||
| } |
Collaborator
Author
There was a problem hiding this comment.
Don't love how this looks really, but I suppose it should suffice.
| return super().insert_text(re.sub(self.pat, "", substring), from_undo=from_undo) | ||
|
|
||
|
|
||
| class ComputedLengthTextField(ResizableTextField): |
Collaborator
Author
There was a problem hiding this comment.
Definitely not a fan of copying over these methods like this, but I couldn't really see another way to adjust the behvaior. Because it's kivy, temporarily changing the text value itself causes it to re-call the same listeners and die.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is this fixing or adding?
The options page on WebHost has for a while prevented the user from entering valid names due to the length cap, even when after replacing tags like
{player}it'd actually be below 16 characters. The Options Creator also opted to match WebHost behavior here. This changes both so that they'll handle this case more specifically.You can't know how long exactly these tags will become given multiple players, but this assumes the best case of 1 character where it may work sometimes. I also kept the handling simple and ignored things like the handling of
%chars. (I originally intended on calling out tohandle_namein the Options Creator directly, but it only returns the truncated output which isn't very helpful).On the players page with no JS, it'll retain the current behavior. I decided to remove the cap entirely on the weighted options page since it's advanced, these names are technically still valid, and it already handles an empty name differently, but it could be ported there too if wanted.
How was this tested?
On local webhost and with the options creator by trying some names that should and shouldn't be valid given this check.
If this makes graphical changes, please attach screenshots.