Compare commits
7 Commits
main
...
840e70523e
| Author | SHA1 | Date | |
|---|---|---|---|
| 840e70523e | |||
| 1e1344567f | |||
| be49729af2 | |||
| 1374af8439 | |||
| a2f059652d | |||
| 2ab78acaa6 | |||
| 43279810a5 |
@@ -164,14 +164,11 @@ impl App {
|
|||||||
/// editor rather than leaving an empty column.
|
/// editor rather than leaving an empty column.
|
||||||
pub(super) fn left_pane(&mut self, ctx: &egui::Context) {
|
pub(super) fn left_pane(&mut self, ctx: &egui::Context) {
|
||||||
let show_files = self.config.show_file_panel;
|
let show_files = self.config.show_file_panel;
|
||||||
|
if show_files {
|
||||||
egui::SidePanel::left("files")
|
egui::SidePanel::left("files")
|
||||||
.resizable(true)
|
.resizable(true)
|
||||||
.default_width(260.0)
|
.width_range(260.0..=600.0)
|
||||||
// A hard ceiling: the panel is sized from its content, so any row
|
.show(ctx, |ui| {
|
||||||
// that asks for more width than there is would otherwise push it
|
|
||||||
// wider every frame.
|
|
||||||
.width_range(160.0..=460.0)
|
|
||||||
.show_animated(ctx, show_files, |ui| {
|
|
||||||
// The default theme renders unselected list rows fairly dim; bump
|
// The default theme renders unselected list rows fairly dim; bump
|
||||||
// the widget text colours so file names stay legible (especially in
|
// the widget text colours so file names stay legible (especially in
|
||||||
// dark mode) without affecting the rest of the app.
|
// dark mode) without affecting the rest of the app.
|
||||||
@@ -251,7 +248,8 @@ impl App {
|
|||||||
// Measured once, from the panel rather than from the scrolled
|
// Measured once, from the panel rather than from the scrolled
|
||||||
// content: reading `available_width()` inside a row makes the
|
// content: reading `available_width()` inside a row makes the
|
||||||
// content's width depend on the content's width.
|
// content's width depend on the content's width.
|
||||||
let row_width = ui.available_width();
|
// Cap the width to prevent the panel from expanding infinitely.
|
||||||
|
let row_width = ui.available_width().min(580.0);
|
||||||
let nested = rows.iter().any(|r| r.depth > 0);
|
let nested = rows.iter().any(|r| r.depth > 0);
|
||||||
|
|
||||||
egui::ScrollArea::vertical()
|
egui::ScrollArea::vertical()
|
||||||
@@ -609,6 +607,7 @@ impl App {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// What a file row's right-click menu asked for. The menu records the choice
|
/// What a file row's right-click menu asked for. The menu records the choice
|
||||||
/// rather than acting on it, because the list is drawn inside a closure that is
|
/// rather than acting on it, because the list is drawn inside a closure that is
|
||||||
|
|||||||
Reference in New Issue
Block a user