feat: Add file panel width persistence to config
- Add file_panel_width field to Config struct with default of 260.0 - Use stored width as default_width for the file list panel - Update config when panel is resized by dragging separator - This ensures panel maintains its width across sessions and only changes when user explicitly drags the separator Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
+12
-3
@@ -165,10 +165,12 @@ impl App {
|
||||
pub(super) fn left_pane(&mut self, ctx: &egui::Context) {
|
||||
let show_files = self.config.show_file_panel;
|
||||
if show_files {
|
||||
egui::SidePanel::left("files")
|
||||
let panel = egui::SidePanel::left("files")
|
||||
.resizable(true)
|
||||
.width_range(260.0..=600.0)
|
||||
.show(ctx, |ui| {
|
||||
.default_width(self.config.file_panel_width)
|
||||
.width_range(260.0..=600.0);
|
||||
|
||||
let response = panel.show(ctx, |ui| {
|
||||
// The default theme renders unselected list rows fairly dim; bump
|
||||
// the widget text colours so file names stay legible (especially in
|
||||
// dark mode) without affecting the rest of the app.
|
||||
@@ -604,6 +606,13 @@ impl App {
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Update the config with the current panel width if it changed
|
||||
let new_width = response.response.rect.width();
|
||||
if (new_width - self.config.file_panel_width).abs() > 0.1 {
|
||||
self.config.file_panel_width = new_width;
|
||||
self.config.save();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user