Skip to content

Commit cfb65af

Browse files
committed
fix: save columns on removal
Fixes: #432 Signed-off-by: William Casarin <[email protected]>
1 parent 91016fa commit cfb65af

File tree

3 files changed

+9
-18
lines changed

3 files changed

+9
-18
lines changed

src/app.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -513,8 +513,6 @@ fn update_damus(damus: &mut Damus, ctx: &egui::Context) {
513513
}
514514

515515
damus.app_rect_handler.try_save_app_size(ctx);
516-
517-
damus.columns.attempt_perform_deletion_request();
518516
}
519517

520518
fn process_event(damus: &mut Damus, _subid: &str, event: &str) {

src/column.rs

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ pub struct Columns {
6161

6262
/// The selected column for key navigation
6363
selected: i32,
64-
should_delete_column_at_index: Option<usize>,
6564
}
6665
static UIDS: AtomicU32 = AtomicU32::new(0);
6766

@@ -207,22 +206,15 @@ impl Columns {
207206
self.selected += 1;
208207
}
209208

210-
pub fn request_deletion_at_index(&mut self, index: usize) {
211-
self.should_delete_column_at_index = Some(index);
212-
}
213-
214-
pub fn attempt_perform_deletion_request(&mut self) {
215-
if let Some(index) = self.should_delete_column_at_index {
216-
if let Some((key, _)) = self.columns.get_index_mut(index) {
217-
self.timelines.shift_remove(key);
218-
}
209+
pub fn delete_column(&mut self, index: usize) {
210+
if let Some((key, _)) = self.columns.get_index_mut(index) {
211+
self.timelines.shift_remove(key);
212+
}
219213

220-
self.columns.shift_remove_index(index);
221-
self.should_delete_column_at_index = None;
214+
self.columns.shift_remove_index(index);
222215

223-
if self.columns.is_empty() {
224-
self.new_column_picker();
225-
}
216+
if self.columns.is_empty() {
217+
self.new_column_picker();
226218
}
227219
}
228220

src/nav.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,11 +205,12 @@ pub fn render_nav(col: usize, app: &mut Damus, ui: &mut egui::Ui) -> bool {
205205
if let Some(title_response) = nav_response.title_response {
206206
match title_response {
207207
TitleResponse::RemoveColumn => {
208-
app.columns_mut().request_deletion_at_index(col);
209208
let tl = app.columns().find_timeline_for_column_index(col);
210209
if let Some(timeline) = tl {
211210
unsubscribe_timeline(app.ndb(), timeline);
212211
}
212+
app.columns_mut().delete_column(col);
213+
col_changed = true;
213214
}
214215
}
215216
}

0 commit comments

Comments
 (0)