-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Labels
Milestone
Description
Bug Description
When a string with a leading newline is passed to the Text widget, the text below that newline does not show up. It appears that this leading newline is not being included in some height computation because if there are multiple lines of text after a single leading newline, only the last line of text gets swallowed.
What did I Expect to Happen?
I would expect that leading newlines get included in the text that is displayed as well as all of the following text.
Minimal Example
use iced::{Element, Sandbox, Settings, Text};
pub fn main() {
Bug::run(Settings::default())
}
struct Bug;
impl Sandbox for Bug {
type Message = ();
fn new() -> Bug {
Bug
}
fn title(&self) -> String {
String::from("A minimal repro")
}
fn update(&mut self, _message: Self::Message) {
}
fn view(&mut self) -> Element<Self::Message> {
Text::new("\nmissing").into()
}
}Screenshot
Multi-line Example
use iced::{Element, Sandbox, Settings, Text};
pub fn main() {
Bug::run(Settings::default())
}
struct Bug;
impl Sandbox for Bug {
type Message = ();
fn new() -> Bug {
Bug
}
fn title(&self) -> String {
String::from("A minimal repro")
}
fn update(&mut self, _message: Self::Message) {
}
fn view(&mut self) -> Element<Self::Message> {
Text::new("\nnow it shows up\nthis guy is missing though").into()
}
}Screenshot
More details about my system
$ uname -a
Darwin ethanpailesmac 18.7.0 Darwin Kernel Version 18.7.0: Mon Feb 10 21:08:45 PST 2020; root:xnu-4903.278.28~1/RELEASE_X86_64 x86_64Reactions are currently unavailable

