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

Multiline Texts #182

Closed
BafDyce opened this issue Aug 14, 2020 · 2 comments
Closed

Multiline Texts #182

BafDyce opened this issue Aug 14, 2020 · 2 comments
Labels
A-UI Graphical user interfaces, styles, layouts, and widgets C-Bug An unexpected or incorrect behavior

Comments

@BafDyce
Copy link
Contributor

BafDyce commented Aug 14, 2020

Apparently Text (docs) does not support multi line strings. Not sure if this is expected (but undocumented) behavior or a bug?

I simply made the following change to the examples/ui/text.rs example:

diff --git a/examples/ui/text.rs b/examples/ui/text.rs
index ecd7f081..c511ef38 100644
--- a/examples/ui/text.rs
+++ b/examples/ui/text.rs
@@ -17,7 +17,7 @@ fn text_update_system(diagnostics: Res<Diagnostics>, mut query: Query<&mut Text>
     for mut text in &mut query.iter() {
         if let Some(fps) = diagnostics.get(FrameTimeDiagnosticsPlugin::FPS) {
             if let Some(average) = fps.average() {
-                text.value = format!("FPS: {:.2}", average);
+                text.value = format!("FPS: {:.2}\nsecond line", average);
             }
         }
     }

Expected behavior: two lines of output

Actual behavior: single line of output:
image

@karroffel karroffel added the C-Bug An unexpected or incorrect behavior label Aug 14, 2020
@karroffel karroffel added the A-UI Graphical user interfaces, styles, layouts, and widgets label Aug 14, 2020
@cart
Copy link
Member

cart commented Aug 14, 2020

Yeah this is an expected behavior. We just haven't implemented line breaking yet. Thanks for the pr!

@Moxinilian
Copy link
Member

Fixed by #183 and #765

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-UI Graphical user interfaces, styles, layouts, and widgets C-Bug An unexpected or incorrect behavior
Projects
None yet
Development

No branches or pull requests

4 participants