Skip to content

Commit

Permalink
Reset starred tissue when removing it
Browse files Browse the repository at this point in the history
  • Loading branch information
evie-calico committed Sep 17, 2024
1 parent c449465 commit 958d14b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "tissuebox"
description = "A todo list for programming"
license = "MIT"
version = "1.0.0"
version = "1.1.0"
edition = "2021"

[dependencies]
Expand Down
6 changes: 6 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,12 @@ impl TissueBox {

#[must_use]
pub fn remove(&mut self, index: usize) -> Option<Tissue> {
// If this issue is starred, reset the star state.
if let Some(i) = self.starred {
if i == index {
self.starred = None;
}
}
self.tissues.get(index)?;
let tissue = self.tissues.remove(index);
self.recycle_bin.push(tissue.clone());
Expand Down

0 comments on commit 958d14b

Please sign in to comment.