notedeck

One damus client to rule them all
git clone git://jb55.com/notedeck
Log | Files | Refs | README | LICENSE

commit adb3359bd8726299312f091e9efc77a541c1194e
parent 0b22ca345ce5b34e9b83b230e66774ea550dc02d
Author: William Casarin <jb55@jb55.com>
Date:   Mon, 17 Mar 2025 11:38:24 -0700

debug: fix debug crash when adding columns

Signed-off-by: William Casarin <jb55@jb55.com>

Diffstat:
Mcrates/notedeck_columns/src/app.rs | 21++++++++++-----------
1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/crates/notedeck_columns/src/app.rs b/crates/notedeck_columns/src/app.rs @@ -549,12 +549,10 @@ fn render_damus_desktop(app: &mut Damus, app_ctx: &mut AppContext<'_>, ui: &mut } fn timelines_view(ui: &mut egui::Ui, sizes: Size, app: &mut Damus, ctx: &mut AppContext<'_>) { + let num_cols = get_active_columns(ctx.accounts, &app.decks_cache).num_columns(); StripBuilder::new(ui) .size(Size::exact(ui::side_panel::SIDE_PANEL_WIDTH)) - .sizes( - sizes, - get_active_columns(ctx.accounts, &app.decks_cache).num_columns(), - ) + .sizes(sizes, num_cols) .clip(true) .horizontal(|mut strip| { let mut side_panel_action: Option<nav::SwitchingAction> = None; @@ -588,13 +586,6 @@ fn timelines_view(ui: &mut egui::Ui, sizes: Size, app: &mut Damus, ctx: &mut App ); }); - let mut save_cols = false; - if let Some(action) = side_panel_action { - save_cols = - save_cols || action.process(&mut app.timeline_cache, &mut app.decks_cache, ctx); - } - - let num_cols = app.columns(ctx.accounts).num_columns(); let mut responses = Vec::with_capacity(num_cols); for col_index in 0..num_cols { strip.cell(|ui| { @@ -615,6 +606,14 @@ fn timelines_view(ui: &mut egui::Ui, sizes: Size, app: &mut Damus, ctx: &mut App //strip.cell(|ui| timeline::timeline_view(ui, app, timeline_ind)); } + // process the side panel action after so we don't change the number of columns during + // StripBuilder rendering + let mut save_cols = false; + if let Some(action) = side_panel_action { + save_cols = + save_cols || action.process(&mut app.timeline_cache, &mut app.decks_cache, ctx); + } + for response in responses { let save = response.process_render_nav_response(app, ctx); save_cols = save_cols || save;