emilk / emilk/egui

Code indentation breaks out of column

Open
#7,045 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
Rust
Stars
30.6k
Forks
2.1k
Avg merge
1d 9h
Merged PRs (30d)
72

Description

Placing a `Ui::code` directly in a `Ui::columns` results in indented lines breaking the layout and sticking out of the column:

![Image](https://github.com/user-attachments/assets/1ea6e462-22c6-4e21-bf9d-92161ec9bd3c)

Wrapping the column content in a `vertical` apparently fixes this. I'm still opening this issue since this doesn't seem like something that should be happening. Note that the same happens with `Ui::monospace`, I just chose `code` for my example because the background makes it easier to see what's going on.

**To Reproduce**
Execute the following code against either the latest version of eframe (0.31.1) or master.

```rust
use eframe::::egui;

fn main() {
eframe::run_simple_native(
"repro",
eframe::NativeOptions::default(),
move |ctx, _frame| {
egui::CentralPanel::default().show(ctx, |ui| {
ui.columns(2, |columns| {
columns[1].code(
r#"
Line1 has no indentation
Line2 has some indentation
"#
.trim(),
)
});
});
},
);
}
```

Contributor guide

Open the contributing guide

Research direction

Start by running the provided eframe reproducer and inspect the egui Ui::columns, Ui::code, and Ui::monospace entry points involved in the layout. The issue is done when indented code remains within its column without requiring a vertical wrapper, with regression coverage for the reproduced case.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.