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

Text selection panic on multi-line labels #492

Closed
dominikwilkowski opened this issue Jun 5, 2024 · 3 comments
Closed

Text selection panic on multi-line labels #492

dominikwilkowski opened this issue Jun 5, 2024 · 3 comments

Comments

@dominikwilkowski
Copy link
Contributor

If I extend the widget gallery with the code below:

widget-gallery/src/labels.rs

use floem::{
    cosmic_text::{Style as FontStyle, Weight},
    peniko::Color,
    views::{label, static_label, tooltip, Decorators},
    IntoView,
};

use crate::form::{form, form_item};

pub fn label_view() -> impl IntoView {
    form({
        (
            form_item("Simple Label:".to_string(), 120.0, || {
                tooltip(label(move || "This is a simple label".to_owned()), || {
                    static_label("This is a tooltip for the label.")
                })
            }),
            form_item("Styled Label:".to_string(), 120.0, || {
                label(move || "This is a styled label".to_owned()).style(|s| {
                    s.background(Color::YELLOW)
                        .padding(10.0)
                        .color(Color::GREEN)
                        .font_weight(Weight::BOLD)
                        .font_style(FontStyle::Italic)
                        .font_size(24.0)
                })
            }),
+             form_item("Simple Label:".to_string(), 120.0, || {
+                 "My multiline label\nWith a second line\nAnd a third"
+             }),
        )
    })
}

The text select crashes as soon as I start the selection on the middle line and select up and down.
text-selection

@jrmoulton
Copy link
Collaborator

I have other multiline labels that are working just fine. Not sure why this one in particular is crashing

@dominikwilkowski
Copy link
Contributor Author

It crashes in my app as well which is how I found this.

@dominikwilkowski
Copy link
Contributor Author

fixed via #493

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants