Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a700eed63c | |||
| 80f3d50fc4 |
+38
-6
@@ -415,13 +415,32 @@ impl App {
|
|||||||
+ if show_tag { tag_w } else { 0.0 };
|
+ if show_tag { tag_w } else { 0.0 };
|
||||||
let name_w =
|
let name_w =
|
||||||
(row_width - indent - trailing).max(0.0);
|
(row_width - indent - trailing).max(0.0);
|
||||||
|
// `add_sized` centers a widget
|
||||||
|
// smaller than the box it's given
|
||||||
|
// — fine for a fixed-width badge,
|
||||||
|
// but it let a short folder name
|
||||||
|
// drift away from the indent that
|
||||||
|
// was just drawn for it, and
|
||||||
|
// further than its own deeper
|
||||||
|
// children whose names fill more
|
||||||
|
// of their (narrower) box. Pinning
|
||||||
|
// `main_align` to the start keeps
|
||||||
|
// the name anchored right after
|
||||||
|
// the indent regardless of length.
|
||||||
let button_response = ui
|
let button_response = ui
|
||||||
.add_sized(
|
.allocate_ui_with_layout(
|
||||||
[name_w, 20.0],
|
egui::vec2(name_w, 20.0),
|
||||||
|
egui::Layout::left_to_right(egui::Align::Center)
|
||||||
|
.with_main_align(egui::Align::Min),
|
||||||
|
|ui| {
|
||||||
|
ui.add(
|
||||||
egui::Button::new(text)
|
egui::Button::new(text)
|
||||||
.frame(false)
|
.frame(false)
|
||||||
.truncate(),
|
.truncate(),
|
||||||
)
|
)
|
||||||
|
},
|
||||||
|
)
|
||||||
|
.inner
|
||||||
.on_hover_text(&row.path);
|
.on_hover_text(&row.path);
|
||||||
|
|
||||||
if button_response.clicked() {
|
if button_response.clicked() {
|
||||||
@@ -563,16 +582,29 @@ impl App {
|
|||||||
// file name simply spills out of the
|
// file name simply spills out of the
|
||||||
// panel. The wrap mode is what it
|
// panel. The wrap mode is what it
|
||||||
// actually reads.
|
// actually reads.
|
||||||
|
//
|
||||||
|
// `add_sized` also *centers* a
|
||||||
|
// widget narrower than the box
|
||||||
|
// it's given, which drifted short
|
||||||
|
// file names away from the indent
|
||||||
|
// just like folder names did —
|
||||||
|
// `with_main_align(Min)` pins it
|
||||||
|
// to the start instead.
|
||||||
let mut label = ui
|
let mut label = ui
|
||||||
.scope(|ui| {
|
.scope(|ui| {
|
||||||
ui.style_mut().wrap_mode =
|
ui.style_mut().wrap_mode =
|
||||||
Some(egui::TextWrapMode::Truncate);
|
Some(egui::TextWrapMode::Truncate);
|
||||||
ui.add_sized(
|
ui.allocate_ui_with_layout(
|
||||||
[label_w, 20.0],
|
egui::vec2(label_w, 20.0),
|
||||||
egui::SelectableLabel::new(
|
egui::Layout::left_to_right(egui::Align::Center)
|
||||||
|
.with_main_align(egui::Align::Min),
|
||||||
|
|ui| {
|
||||||
|
ui.add(egui::SelectableLabel::new(
|
||||||
selected, text,
|
selected, text,
|
||||||
),
|
))
|
||||||
|
},
|
||||||
)
|
)
|
||||||
|
.inner
|
||||||
})
|
})
|
||||||
.inner;
|
.inner;
|
||||||
if let Some(tooltip) = &tooltip {
|
if let Some(tooltip) = &tooltip {
|
||||||
|
|||||||
@@ -541,6 +541,11 @@ impl App {
|
|||||||
self.spell_menu = None;
|
self.spell_menu = None;
|
||||||
self.clear_lt();
|
self.clear_lt();
|
||||||
self.autocomplete = None;
|
self.autocomplete = None;
|
||||||
|
// Story Bible reference ranges are char offsets into `buffer` too —
|
||||||
|
// stale ones (from before the header moved in or out) land on
|
||||||
|
// whatever text now happens to sit `header.len()` characters away
|
||||||
|
// from the real mention.
|
||||||
|
self.update_current_references();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// How many header fields are hidden right now, for the toggle's label.
|
/// How many header fields are hidden right now, for the toggle's label.
|
||||||
|
|||||||
Reference in New Issue
Block a user