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
Add text replacement methods #1755
Add text replacement methods #1755
Conversation
@pie-flavor Is this still Work In Progress? if so reply with |
Is Text not meant to be imutable: Represents an immutable tree-structure of formatted (text) components. Each instance consists of content and a list of children texts appended after the content of this text. The content of the text is available through one of the subclasses. |
Sure, but it's a utility function for something that is inherently difficult to do yourself 100% correctly the first time. Strings are immutable too, doesn't stop them having replace, but it's not something you would want to (ab)use all the time. My 2c. |
I don't see a problem with it as long as the javadocs make it clear (in both the body and the returns statement) that the method returns a copy of the |
@The-Defman I'm confused - where's the issue? The original text never gets modified. @dualspiral I'll add that, though originally I never thought it could be an issue - anyone using Text.replace has inevitably used String.replace which behaves the same way. |
Can this be added to the next 7.x release or is that against semver? |
No API methods get broken, so 7.x should be a valid target. |
Needs to be updated since the text was refactored. |
@gabizou This targets API 7 |
@Cybermaxke you need to change the target branch to stable-7 then |
Oh good, the git history got clonked. Is this worth pursuing in its current state? Will there be another API 7 release? |
@pie-flavor Yes, please update and rebase |
4570105
to
4383e22
Compare
Looks all good from here. |
Maybe |
Properly searching for a Text would require remembering the effective formatting of the text in addition to the Text's own formatting, and additionally parsing children, greatly complicating the algorithm. And there wouldn't really be a point in a Text argument that's only ever used via toPlain. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Working as intended
You need to add these methods to API 8. |
These are very much needed, given the relative underpoweredness of
TextTemplate
s.