Strikethrough completed TODO items in todo_read/todo_write output
Completed items (- [x]) now display with strikethrough text: ■ ~~Write tests~~ Incomplete items remain unchanged: □ Implement feature
This commit is contained in:
@@ -623,12 +623,20 @@ impl UiWriter for ConsoleUiWriter {
|
|||||||
let is_last = i == last_idx;
|
let is_last = i == last_idx;
|
||||||
let prefix = if is_last { "└" } else { "│" };
|
let prefix = if is_last { "└" } else { "│" };
|
||||||
|
|
||||||
// Convert checkboxes to styled symbols
|
// Convert checkboxes to styled symbols and strikethrough completed items
|
||||||
let styled_line = line
|
let is_completed = line.contains("- [x]") || line.contains("- [X]");
|
||||||
.replace("- [x]", "■")
|
let styled_line = if is_completed {
|
||||||
.replace("- [X]", "■")
|
// Replace checkbox and apply strikethrough to the task text
|
||||||
.replace("- [ ]", "□");
|
let task_text = line
|
||||||
|
.replace("- [x]", "")
|
||||||
|
.replace("- [X]", "")
|
||||||
|
.trim_start()
|
||||||
|
.to_string();
|
||||||
|
format!("■ \x1b[9m{}\x1b[0m\x1b[2m", task_text) // \x1b[9m is strikethrough
|
||||||
|
} else {
|
||||||
|
line.replace("- [ ]", "□")
|
||||||
|
};
|
||||||
|
|
||||||
// Dim the line content
|
// Dim the line content
|
||||||
println!(" \x1b[2m{} {}\x1b[0m", prefix, styled_line);
|
println!(" \x1b[2m{} {}\x1b[0m", prefix, styled_line);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user