Code indentation breaks out of column
- 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:

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
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