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

Fix usage of String.left() #48927

Merged
merged 1 commit into from
May 22, 2021
Merged

Conversation

KoBeWi
Copy link
Member

@KoBeWi KoBeWi commented May 21, 2021

#36180 changed behavior of negative arguments in left(). Previously it would return empty string. Some code relied on that behavior, so this PR fixes it.

*Bugsquad edit: This closes #48951.

@KoBeWi KoBeWi added this to the 4.0 milestone May 21, 2021
@KoBeWi KoBeWi requested a review from a team as a code owner May 21, 2021 13:20
@KoBeWi KoBeWi force-pushed the I_fixed_your_left branch from c29118b to e326a7a Compare May 21, 2021 13:32
@@ -939,6 +939,7 @@ const char32_t *String::get_data() const {
}

void String::erase(int p_pos, int p_chars) {
p_pos = MAX(p_pos, 0);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should it fail on negative indices instead?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could change it to fail, I just wanted to preserve the previous behavior.

@akien-mga akien-mga merged commit 5d2d242 into godotengine:master May 22, 2021
@akien-mga
Copy link
Member

Thanks!

@KoBeWi KoBeWi deleted the I_fixed_your_left branch May 22, 2021 11:12
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.

Editor settings window doesn't display last letter of entry headers
3 participants