Skip to content

egui egui::TextEdit::singleline long text will make ui.horizontal invalid #5597

@januwA

Description

@januwA

Describe the bug
GIF 2025-1-11 13-14-10

To Reproduce
Steps to reproduce the behavior:

Expected behavior
The width of singleline has not changed. Horizontal should use the width of singleline instead of the length of the text.

Screenshots

Desktop (please complete the following information):

  • OS: win11
  • Browser
  • Version

Smartphone (please complete the following information):

  • Device:
  • OS:
  • Browser
  • Version

Additional context

 cargo --version
cargo 1.84.0 (66221abde 2024-11-19)
[dependencies]
eframe = { version = "0.30.0", default-features = false, features = ["accesskit", "glow", "persistence"]}
egui_extras = { version = "0.30", features = ["image"] }
ui.horizontal(|ui| {
                    egui::TextEdit::singleline(&mut httpConfig.name)
                        .desired_width(100.0)
                        .show(ui);
                    
                    egui::ComboBox::from_id_source("method")
                        .selected_text(httpConfig.req_cfg.method.as_ref())
                        .show_ui(ui, |ui| {
                            for m in &METHODS {
                                ui.selectable_value(
                                    &mut httpConfig.req_cfg.method,
                                    m.to_owned(),
                                    m.as_ref(),
                                );
                            }
                        });

                    ui.add(
                        egui::TextEdit::singleline(&mut httpConfig.req_cfg.url)
                            .desired_width(300.)
                            .hint_text("http url"),
                    );

                    ui.add(
                        egui::TextEdit::singleline(&mut httpConfig.send_count_ui)
                            .desired_width(60.)
                            .hint_text("Count"),
                    );

                    if ui
                        .add_enabled(!httpConfig.req_cfg.url.is_empty(), egui::Button::new("Send"))
                        .clicked()
                    {
                    }

                    ui.separator();

                    // request result count
                    let (s, e, r) = httpConfig.get_request_reper();
                    ui.label(format!("s:{s}, e:{e}, r:{r}"));

                    ui.separator();
                });

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething is broken

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions