remove Task, count changes explicitly

This commit is contained in:
🪞👃🪞 2025-04-06 19:13:25 +03:00
parent 4de94beafb
commit 84f183ab84
7 changed files with 23 additions and 40 deletions

View file

@ -2,7 +2,6 @@ use crate::*;
mod column; pub use self::column::*;
mod entry; pub use self::entry::*;
mod task; pub use self::task::*;
/// The application state.
pub struct Taggart {
@ -13,11 +12,10 @@ pub struct Taggart {
pub column: usize,
pub columns: Columns<fn(&Entry)->Option<Arc<str>>, fn(&mut Self, usize, &str)>,
pub display: Measure<TuiOut>,
pub tasks: Vec<Task>,
/// State of modal dialog of editing field
pub mode: Option<Mode>,
/// Count of modified items
pub modified: usize,
/// Count of changes to items
pub changes: usize,
}
#[derive(Debug)]
@ -38,9 +36,8 @@ impl Taggart {
display: Measure::new(),
mode: None,
columns: Columns::default(),
tasks: vec![],
entries,
modified: 0
changes: 0
})
}
/// Make sure cursor is always in view
@ -62,14 +59,14 @@ impl Taggart {
}
}
/// Count modified entries
pub(crate) fn count_modified (&mut self) -> usize {
let mut modified = 0;
pub(crate) fn count_changes (&mut self) -> usize {
let mut changes = 0;
for entry in self.entries.iter() {
if entry.is_modified() {
modified += 1;
changes += 1;
}
}
self.modified = modified;
self.modified
self.changes = changes;
self.changes
}
}