notes
This commit is contained in:
@@ -94,7 +94,6 @@ fn update_notes(notes_path: &Path) {
|
||||
linebuf.clear();
|
||||
}
|
||||
|
||||
// Find duplicates
|
||||
let mut todos_hashset: HashSet<&str> = HashSet::new();
|
||||
let split_lines = all_lines.rsplit("\n");
|
||||
for (rev_idx, line) in split_lines.enumerate() {
|
||||
@@ -107,13 +106,8 @@ fn update_notes(notes_path: &Path) {
|
||||
let Some(todotext) = trimmed_str.get(6..) else {
|
||||
continue;
|
||||
};
|
||||
if !todos_hashset.insert(todotext) {
|
||||
// false if dupl
|
||||
if !todos_hashset.insert(todotext) || is_done(prefix) {
|
||||
lines_to_not_use.push(org_idx);
|
||||
} else {
|
||||
if is_done(prefix) {
|
||||
lines_to_not_use.push(org_idx);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -136,15 +130,14 @@ fn update_notes(notes_path: &Path) {
|
||||
|
||||
let mut cur = lines_to_not_use.len() - 1;
|
||||
for (idx, line) in all_lines.split("\n").enumerate() {
|
||||
if cur > 0 && lines_to_not_use.get(cur).unwrap() == &idx {
|
||||
cur -= 1;
|
||||
if lines_to_not_use.get(cur).unwrap() == &idx {
|
||||
cur = cur.saturating_sub(1);
|
||||
} else {
|
||||
writeln!(linebuf, "{line}").unwrap_or_else(|e| panic!("{e}"));
|
||||
}
|
||||
}
|
||||
|
||||
file.write_all(linebuf.as_bytes()).unwrap_or_else(|e| panic!("Maaan look out for these files. Error is: {e}"));
|
||||
// dbg!(&linebuf);
|
||||
}
|
||||
|
||||
// fn parse_patterns(notes_path: &Path, patterns_path: &Path) {
|
||||
|
||||
Reference in New Issue
Block a user