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

Labels with tabs-only text don't allocate space #3203

Closed
tvanderstad opened this issue Aug 4, 2023 · 2 comments · Fixed by #3355
Closed

Labels with tabs-only text don't allocate space #3203

tvanderstad opened this issue Aug 4, 2023 · 2 comments · Fixed by #3355
Labels
bug Something is broken
Milestone

Comments

@tvanderstad
Copy link

Describe the bug
Labels with only tabs in their text don't allocate space e.g. don't affect the layout of subsequent labels. This is confusing because empty labels do affect the layout.

To Reproduce
Run the following app:

#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]

use eframe::egui;

struct MyApp {}

impl eframe::App for MyApp {
    fn update(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) {
        let long_text = "long text\n".repeat(50);

        egui::CentralPanel::default().show(ctx, |ui| {
            ui.label("-----");
            ui.label(""); // rendered
            ui.label("-----");
            ui.label(" "); // rendered
            ui.label("-----");
            ui.label("\t "); // rendered
            ui.label("-----");
            ui.label("\t"); // NOT rendered
            ui.label("-----");
            ui.label("\t\t"); // NOT rendered
            ui.label("-----");
        });
    }
}

fn main() {
    eframe::run_native(
        "test",
        eframe::NativeOptions {
            drag_and_drop_support: true,
            initial_window_size: Some(egui::vec2(900.0, 600.0)),
            ..Default::default()
        },
        Box::new(|_cc: &eframe::CreationContext| Box::new(MyApp {})),
    )
    .unwrap();
}

Expected behavior
A series of labels with text "-----" spaced equally apart.

Screenshots
Screenshot 2023-08-04 at 12 02 00 PM

Desktop:

  • OS: MacOS Ventura 13.3.1

Additional context
Building a markdown editor for github.com/lockbook/lockbook and not sure how I'm supposed to render tab characters

@tvanderstad tvanderstad added the bug Something is broken label Aug 4, 2023
tvanderstad added a commit to lockbook/lockbook that referenced this issue Aug 6, 2023
based on #1971

fixes #1976 by introducing a
hacky workaround for emilk/egui#3203

This issue represents finding a better/proper fix:
#1983
@emilk emilk added this to the 0.23.0 milestone Aug 10, 2023
@StripedMonkey
Copy link

This appears to have been fixed in git by #3302
image

@emilk
Copy link
Owner

emilk commented Sep 18, 2023

Trailing tab characters also messes up the text layout

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