Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make LineEdit secret character easier to change and enter #81724

Conversation

jsjtxietian
Copy link
Contributor

@jsjtxietian jsjtxietian commented Sep 16, 2023

Fixes #81681.

  1. Allow values longer than 1 character in the property, but trim characters after the first one.
  2. Allow empty strings, this acts like if a space was used as a secret character, so that an error isn't printed when you erase all characters in the property.

About the implementation, we can add another field for displaying the char and so secret_character can only store the result of the above rule or vice versa. But that requires more change, so I decided to change the drawing part, calculate the right secret_character based on the rule above.

@jsjtxietian jsjtxietian requested a review from a team as a code owner September 16, 2023 07:29
@AThousandShips AThousandShips added this to the 4.2 milestone Sep 16, 2023
@jsjtxietian jsjtxietian force-pushed the fix-line-edit-secret-char-hard-to-change branch from 810fdc5 to c28be77 Compare September 16, 2023 07:42
@jsjtxietian jsjtxietian requested a review from a team as a code owner September 16, 2023 07:42
@jsjtxietian jsjtxietian force-pushed the fix-line-edit-secret-char-hard-to-change branch from c28be77 to 0ccdf1d Compare September 16, 2023 13:11
scene/gui/line_edit.cpp Outdated Show resolved Hide resolved
doc/classes/LineEdit.xml Outdated Show resolved Hide resolved
doc/classes/LineEdit.xml Outdated Show resolved Hide resolved
@KoBeWi
Copy link
Member

KoBeWi commented Oct 18, 2023

If extra characters are ignored, maybe we should have a configuration warning saying that.

@jsjtxietian jsjtxietian force-pushed the fix-line-edit-secret-char-hard-to-change branch from ded395f to 3e2b08d Compare October 19, 2023 03:25
@KoBeWi
Copy link
Member

KoBeWi commented Oct 19, 2023

By "configuration warning" I mean get_configuration_warning(). With your current implementation the warning will be spammed in the output.

@jsjtxietian jsjtxietian force-pushed the fix-line-edit-secret-char-hard-to-change branch from 3e2b08d to e699640 Compare October 19, 2023 11:38
scene/gui/line_edit.cpp Outdated Show resolved Hide resolved
@KoBeWi
Copy link
Member

KoBeWi commented Oct 19, 2023

You need to call update_configuration_warnings() in set_secret_character().

@jsjtxietian
Copy link
Contributor Author

I see.

@jsjtxietian jsjtxietian force-pushed the fix-line-edit-secret-char-hard-to-change branch from e699640 to fbbe379 Compare October 19, 2023 12:20
scene/gui/line_edit.cpp Outdated Show resolved Hide resolved
1. Allow values longer than 1 character in the property,
    but trim characters after the first one.
2. Allow empty strings, this acts like if a space was used as a secret character,
    so that an error isn't printed when you erase all characters in the property.
@jsjtxietian jsjtxietian force-pushed the fix-line-edit-secret-char-hard-to-change branch from fbbe379 to 6950aab Compare October 19, 2023 13:32
@akien-mga akien-mga merged commit a434062 into godotengine:master Oct 20, 2023
15 checks passed
@akien-mga
Copy link
Member

Thanks!

@jsjtxietian jsjtxietian deleted the fix-line-edit-secret-char-hard-to-change branch October 20, 2023 14:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

LineEdit secret character hard to change/enter
4 participants