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

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

Open
januwA opened this issue Jan 11, 2025 · 4 comments · May be fixed by #5640
Open

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

januwA opened this issue Jan 11, 2025 · 4 comments · May be fixed by #5640
Labels
bug Something is broken

Comments

@januwA
Copy link

januwA commented Jan 11, 2025

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();
                });
@januwA januwA added the bug Something is broken label Jan 11, 2025
@MetaflameDragon
Copy link

Looks like a duplicate of #5500

@IaVashik
Copy link

Same here. This can be easily reproduced with just ui.add(egui::TextEdit::singleline(&mut some_variable)); inside a CentralPanel. The CentralPanel width becomes larger than the window width, breaking the layout :}

Image
Image

Os: Linux + X11, Native app, eframe v0.30.0

@IaVashik
Copy link

The egui.rs widget gallery exhibits the same bug

@IaVashik
Copy link

This PR created this bug: #3660

IaVashik added a commit to IaVashik/egui-textedit-fix that referenced this issue Jan 26, 2025
@IaVashik IaVashik linked a pull request Jan 26, 2025 that will close this issue
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is broken
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants