iced
iced copied to clipboard
Text truncation by toggling visibility of Text widgets after interaction with PickList
Is there an existing issue for this?
- [X] I have searched the existing issues.
Is this issue related to iced?
- [X] My hardware is compatible and my graphics drivers are up-to-date.
What happened?
I have some Text widgets showing some strings. One of these strings is the exact same as in the list show by a PickList widget. I also have a toggle button for toggling the visibility of the Text widgets. When I hide the Text widgets, click once on the PickList and show the Text elements again, the elements with the same strings as in the PickList are truncated at the last space character.
I'm using iced 0.10.0, nothing else.
use iced::{
widget::{button, column, pick_list, text},
Element, Sandbox, Settings, Theme,
};
#[derive(Debug, Clone)]
pub enum Message {
Select(String),
Toggle,
}
struct MyApp {
show: bool,
}
impl Sandbox for MyApp {
type Message = Message;
fn new() -> Self {
Self { show: true }
}
fn title(&self) -> String {
"Picklist String Bug".to_string()
}
fn update(&mut self, message: Message) {
if let Message::Toggle = message {
self.show = !self.show
}
}
fn view(&self) -> Element<Message> {
let mut ret = column![];
ret = ret.push(button("toggle").on_press(Message::Toggle));
if self.show {
for title in ["A B C".to_string(), "D E F".to_string()] {
ret = ret.push(text(title));
}
}
ret = ret.push(pick_list(
vec!["A B C".to_string(), "Sth different".to_string()],
None,
Message::Select,
));
ret.spacing(10.).into()
}
fn theme(&self) -> Theme {
Theme::Dark
}
}
fn main() -> Result<(), iced::Error> {
MyApp::run(Settings::default())
}
What is the expected behavior?
The strings shouldn't be truncated.
Version
crates.io release
Operating System
Linux
Do you have any log output?
No response
I just checked, whether I have the same issue with the master branch. It seems like this issue is solved on the newest master branch.