emilk / emilk/egui

Horizontal text alignment + text wrap truncation

Open
#2,124 0 comments 0 reactions 0 assignees View on GitHub
feature
Dominant language
Rust
Stars
30.6k
Forks
2.1k
Avg merge
1d 12h
Merged PRs (30d)
67

Description

**Is your feature request related to a problem? Please describe.**
Currently, I have this code
```rust
ui.label(egui::text::LayoutJob {
sections: vec![egui::text::LayoutSection {
leading_space: 0.0,
byte_range: 0..path.len(),
format: egui::TextFormat::simple(egui::FontId::default(), color),
}],
wrap: egui::epaint::text::TextWrapping {
max_rows: 1,
break_anywhere: true,
..Default::default()
},
break_on_newline: false,
halign: egui::Align::RIGHT,
justify: true,
text: path,
..Default::default()
});
```

This renders:

![image](https://user-images.githubusercontent.com/14863743/194763886-2bee9645-53d3-4858-9f17-53262319fa3e.png)

But I was expecting for the ellipsis to show on the LEFT, not the right.

**Describe the solution you'd like**
My use case is showing a bunch of file paths. These aren't very useful when the end of them are cut off, as a bunch of files with the same prefix will just look like the same path.

Thank you :D

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.